Skip to content

Commit

Permalink
fix: more flows integrated
Browse files Browse the repository at this point in the history
Signed-off-by: bryans-go <[email protected]>
  • Loading branch information
divanshu-go committed Sep 27, 2024
1 parent dd825c7 commit 35b7f8e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/algora_web/controllers/user_auth.ex
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ defmodule AlgoraWeb.UserAuth do
defp redirect_require_login(socket) do
socket
|> LiveView.put_flash(:error, "Please sign in")
|> maybe_store_return_to()
|> LiveView.redirect(to: ~p"/auth/login")
end

Expand Down
2 changes: 2 additions & 0 deletions lib/algora_web/live/show_live/show.ex
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
defmodule AlgoraWeb.ShowLive.Show do
use AlgoraWeb, :live_view
import AlgoraWeb.UserAuth, only: [maybe_store_return_to: 1]

alias Algora.{Shows, Library, Events}
alias Algora.Accounts
Expand Down Expand Up @@ -347,6 +348,7 @@ defmodule AlgoraWeb.ShowLive.Show do
cond do
current_user == nil ->
socket
|> maybe_store_return_to()
|> redirect(to: ~p"/auth/login")

current_user.id != show.user_id && !Accounts.admin?(current_user) ->
Expand Down

0 comments on commit 35b7f8e

Please sign in to comment.