Open divanshu-go opened 1 month ago
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")
done
Still seeing a similar error on latest commit when I'm not logged in
@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
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