-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: return to original page after login (#101) #110
base: main
Are you sure you want to change the base?
Conversation
35b7f8e
to
cfcfd18
Compare
Signed-off-by: bryans-go <[email protected]>
cfcfd18
to
e90eb62
Compare
screen-recorder-sat-sep-28-2024-17-10-53.webm |
3a98b23
to
e90eb62
Compare
Signed-off-by: bryans-go <[email protected]>
Thanks for the PR! I'm getting this error on protected LiveViews (eg /channel/settings) # KeyError at GET /channel/settings
# key :conn not found in: nil
# If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map
rescue
Ecto.NoResultsError -> {:halt, redirect_require_login(socket)}
end
defp redirect_require_login(socket) do
conn = Phoenix.LiveView.get_connect_info(socket).conn
conn
# Store the return path before flashing the message
|> maybe_store_return_to()
|> LiveView.put_flash(:error, "Please sign in")
|
Signed-off-by: bryans-go <[email protected]>
done |
Signed-off-by: bryans-go <[email protected]>
Signed-off-by: bryans-go <[email protected]>
Signed-off-by: bryans-go <[email protected]>
Signed-off-by: bryans-go <[email protected]>
Signed-off-by: bryans-go <[email protected]>
@zcesur I even face this on the main branch of repo. There is nothing I can do in it. This is because there is no database for the unauthorized user which is the default behavior on your main branch |
Not sure I understand, in the main branch we redirect to /auth/login. Try visiting https://tv.algora.io/channel/settings |
I meant to say that when I have forked your repository These things were same as shown in the image sent by you |
Hi @divanshu-go, I pulled down your code and even rebased it against Reading through the rest of your code, I am not sure I like storing the redirect url in the query string. It would be much cleaner if you store the redirect url in the user's session. |
Fix Redirect to Original Page After Login (#101)
PR Description:
Ensures users are redirected to their intended page after login by consistently setting the
:user_return_to
session value.Problem:
Users are redirected to the homepage after login if the
:user_return_to
session is not set.Solution:
Updated login flow to always set
:user_return_to
when redirecting to the login page.Closes #101
/claim #101