-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- add proper logout url - proof that with firefox, somehow, the RequireAuth plug gets called after logout
- Loading branch information
1 parent
74aa5c4
commit fdc2ac0
Showing
6 changed files
with
54 additions
and
10 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
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 |
---|---|---|
@@ -1,7 +1,29 @@ | ||
defmodule FotohaeckerWeb.PageController do | ||
use FotohaeckerWeb, :controller | ||
|
||
import FotohaeckerWeb.AuthController, only: [locale_from_session: 1] | ||
|
||
alias FotohaeckerWeb.Router.Helpers | ||
|
||
def index(conn, _params) do | ||
render(conn, "index.html") | ||
end | ||
|
||
def logout(conn, _params) do | ||
locale = locale_from_session(conn) | ||
domain = System.get_env("AUTH0_DOMAIN") | ||
client_id = System.get_env("AUTH0_CLIENT_ID") | ||
|
||
return_to = | ||
conn | ||
|> Helpers.index_home_url(:home, locale) | ||
|> URI.encode_www_form() | ||
|
||
logout_url = "https://#{domain}/v2/logout?returnTo=#{return_to}&client_id=#{client_id}" | ||
|
||
conn | ||
|> put_flash(:info, FotohaeckerWeb.Gettext.gettext("You have been logged out!")) | ||
|> clear_session() | ||
|> redirect(external: logout_url) | ||
end | ||
end |
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
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