diff --git a/CHANGELOG.md b/CHANGELOG.md index f3b71492..3838cae5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,5 @@ +## v2.1.2 + ## v2.1.1 ### Fixes and improvements diff --git a/lib/claper_web/controllers/user_oidc_auth.ex b/lib/claper_web/controllers/user_oidc_auth.ex index 9aaec128..d889f694 100644 --- a/lib/claper_web/controllers/user_oidc_auth.ex +++ b/lib/claper_web/controllers/user_oidc_auth.ex @@ -40,13 +40,19 @@ defmodule ClaperWeb.UserOidcAuth do conn |> UserAuth.log_in_user(oidc_user.user) else - {:error, _} -> + {:error, reason} -> conn - |> put_flash(:error, "Cannot authenticate user.") - |> redirect(to: ~p"/users/log_in") + |> put_status(:unauthorized) + |> put_view(ClaperWeb.ErrorView) + |> render("csrf_error.html", %{error: "Authentication failed: #{inspect(reason)}"}) end + end + def callback(conn, %{"error" => error} = _params) do conn + |> put_status(:unauthorized) + |> put_view(ClaperWeb.ErrorView) + |> render("csrf_error.html", %{error: "Authentication failed: #{error}"}) end defp config do diff --git a/lib/claper_web/templates/error/csrf_error.html.heex b/lib/claper_web/templates/error/csrf_error.html.heex new file mode 100644 index 00000000..6adda259 --- /dev/null +++ b/lib/claper_web/templates/error/csrf_error.html.heex @@ -0,0 +1,22 @@ +
<%= gettext("A required security token was not found or was invalid.") %>
+<%= gettext("If you're continually seeing this issue, try the following:") %>
+<%= gettext("If the problem persists, please contact support.") %>
+