-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Redirect to original page after login, when clicking the login button
Why: - Continuing the migration from SPA to SSR. - An anonymous user can be viewing the support or demo pages when they click the login button.
- Loading branch information
Showing
4 changed files
with
62 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
(:require [clojure.string :as str] | ||
[hiccup2.core :as h] | ||
[territory-bro.api :as api] | ||
[territory-bro.infra.auth0 :as auth0] | ||
[territory-bro.infra.authentication :as auth] | ||
[territory-bro.infra.config :as config] | ||
[territory-bro.infra.resources :as resources] | ||
|
@@ -23,6 +24,8 @@ | |
:congregation congregation | ||
:user (when (auth/logged-in?) | ||
auth/*user*) | ||
:login-url (when-not (auth/logged-in?) | ||
(auth0/login-url request)) | ||
:dev? (getx config/env :dev)}))) | ||
|
||
|
||
|
@@ -102,14 +105,14 @@ | |
:icon "🛟" | ||
:title (i18n/t "SupportPage.title")})]]))) | ||
|
||
(defn authentication-panel [{:keys [user dev?]}] | ||
(defn authentication-panel [{:keys [user login-url dev?]}] | ||
(if (some? user) | ||
(h/html [:i.fa-solid.fa-user-large {:style {:font-size "1.25em" | ||
:vertical-align "middle"}}] | ||
" " (:name user) " " | ||
[:a#logout-button.pure-button {:href "/logout"} | ||
(i18n/t "Navigation.logout")]) | ||
(h/html [:a#login-button.pure-button {:href "/login"} | ||
(h/html [:a#login-button.pure-button {:href login-url} | ||
(i18n/t "Navigation.login")] | ||
(when dev? | ||
(h/html " " [:a#dev-login-button.pure-button {:href "/dev-login?sub=developer&name=Developer&[email protected]"} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters