forked from algora-io/tv
-
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.
fix: return to original page after login (algora-io#101)
Signed-off-by: bryans-go <[email protected]>
- Loading branch information
1 parent
677d6c7
commit e90eb62
Showing
4 changed files
with
20 additions
and
7 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 |
---|---|---|
@@ -1,15 +1,17 @@ | ||
defmodule AlgoraWeb.RedirectController do | ||
use AlgoraWeb, :controller | ||
|
||
import AlgoraWeb.UserAuth, only: [fetch_current_user: 2] | ||
import AlgoraWeb.UserAuth, only: [fetch_current_user: 2, maybe_store_return_to: 1] | ||
|
||
plug :fetch_current_user | ||
|
||
def redirect_authenticated(conn, _) do | ||
if conn.assigns.current_user do | ||
AlgoraWeb.UserAuth.redirect_if_user_is_authenticated(conn, []) | ||
else | ||
redirect(conn, to: ~p"/auth/login") | ||
conn | ||
|> maybe_store_return_to() | ||
|> redirect(to: ~p"/auth/login") | ||
end | ||
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