fix: translation of login page
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
086ecdcb1b
commit
99a8d64344
18 changed files with 487 additions and 200 deletions
|
|
@ -2,8 +2,9 @@ defmodule MvWeb.JoinConfirmController do
|
|||
@moduledoc """
|
||||
Handles GET /confirm_join/:token for the public join flow (double opt-in).
|
||||
|
||||
Calls a configurable callback (default Mv.Membership) so tests can stub the
|
||||
dependency. Public route; no authentication required.
|
||||
Renders a full HTML page with public header and hero layout (success, expired,
|
||||
or invalid). Calls a configurable callback (default Mv.Membership) so tests can
|
||||
stub the dependency. Public route; no authentication required.
|
||||
"""
|
||||
use MvWeb, :controller
|
||||
|
||||
|
|
@ -26,20 +27,36 @@ defmodule MvWeb.JoinConfirmController do
|
|||
|
||||
defp success_response(conn) do
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_resp(200, gettext("Thank you, we have received your request."))
|
||||
|> assign_confirm_assigns(:success)
|
||||
|> put_view(MvWeb.JoinConfirmHTML)
|
||||
|> render("confirm.html")
|
||||
end
|
||||
|
||||
defp expired_response(conn) do
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> send_resp(200, gettext("This link has expired. Please submit the form again."))
|
||||
|> assign_confirm_assigns(:expired)
|
||||
|> put_view(MvWeb.JoinConfirmHTML)
|
||||
|> render("confirm.html")
|
||||
end
|
||||
|
||||
defp invalid_response(conn) do
|
||||
conn
|
||||
|> put_resp_content_type("text/html")
|
||||
|> put_status(404)
|
||||
|> send_resp(404, gettext("Invalid or expired link."))
|
||||
|> assign_confirm_assigns(:invalid)
|
||||
|> put_view(MvWeb.JoinConfirmHTML)
|
||||
|> render("confirm.html")
|
||||
end
|
||||
|
||||
defp assign_confirm_assigns(conn, result) do
|
||||
club_name =
|
||||
case Mv.Membership.get_settings() do
|
||||
{:ok, settings} -> settings.club_name || "Mitgliederverwaltung"
|
||||
_ -> "Mitgliederverwaltung"
|
||||
end
|
||||
|
||||
conn
|
||||
|> assign(:result, result)
|
||||
|> assign(:club_name, club_name)
|
||||
|> assign(:csrf_token, Plug.CSRFProtection.get_csrf_token())
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue