customize login screen and mmbers as landing page closes #68 and #137 #138

Merged
carla merged 5 commits from feature/68_log_in_screen into main 2025-08-21 13:49:43 +02:00
Showing only changes of commit 7e2aa49674 - Show all commits

View file

@ -37,7 +37,8 @@ defmodule MvWeb.LiveUserAuth do
end end
def on_mount(:live_no_user, _params, session, socket) do def on_mount(:live_no_user, _params, session, socket) do
# Set the locale for not logged in user to set the language # Set the locale for not logged in user to set the language in the Log-In Screen
rafael marked this conversation as resolved Outdated

Is there a way to detect the language of the user automatically? Maybe phoenix has a feature for that. This would make sure that folks who don't speak german will get the english login page. I think it makes sense to display the login page in german as a fallback, if the browser doesn't send a preferred language. Maybe we can open an issue for that? :)

Is there a way to detect the language of the user automatically? Maybe phoenix has a feature for that. This would make sure that folks who don't speak german will get the english login page. I think it makes sense to display the login page in german as a fallback, if the browser doesn't send a preferred language. Maybe we can open an issue for that? :)

I think adding a language switch to the login screen needs more customization than the overrides AshAuthentication provides. As I think it's not that high priority right now I added another issue, but to not spend time on it right now. Is that fine?

I think adding a language switch to the login screen needs more customization than the overrides AshAuthentication provides. As I think it's not that high priority right now I added another issue, but to not spend time on it right now. Is that fine?

Yes, totally fine!

Yes, totally fine!
# otherwise the locale is not taken for the Log-In Screen
locale = session["locale"] || "en" locale = session["locale"] || "en"
rafael marked this conversation as resolved Outdated

Do we also need to set the locale here when the router already does it?

Do we also need to set the locale here when the router already does it?

Yes, otherwise the login scren is not translated. At least I found no other way.

Yes, otherwise the login scren is not translated. At least I found no other way.

Okay, could you add a comment saying that this is the reason? This will make it easier to understand if somebody stumbles upon this in the future :)

Okay, could you add a comment saying that this is the reason? This will make it easier to understand if somebody stumbles upon this in the future :)
Gettext.put_locale(MvWeb.Gettext, locale) Gettext.put_locale(MvWeb.Gettext, locale)
{:cont, assign(socket, :locale, locale)} {:cont, assign(socket, :locale, locale)}