fix: tests and flash layout
This commit is contained in:
parent
a25263b721
commit
002d723d0e
6 changed files with 85 additions and 15 deletions
|
|
@ -88,7 +88,10 @@ defmodule MvWeb.AuthController do
|
|||
Logger.warning("OIDC authentication server unreachable", safe_assent_meta(err))
|
||||
|
||||
conn
|
||||
|> put_flash(:error, gettext("The authentication server is currently unavailable. Please try again later."))
|
||||
|> put_flash(
|
||||
:error,
|
||||
gettext("The authentication server is currently unavailable. Please try again later.")
|
||||
)
|
||||
|> redirect(to: ~p"/sign-in")
|
||||
end
|
||||
|
||||
|
|
@ -98,7 +101,10 @@ defmodule MvWeb.AuthController do
|
|||
Logger.warning("OIDC authentication invalid response", safe_assent_meta(err))
|
||||
|
||||
conn
|
||||
|> put_flash(:error, gettext("Authentication configuration error. Please contact the administrator."))
|
||||
|> put_flash(
|
||||
:error,
|
||||
gettext("Authentication configuration error. Please contact the administrator.")
|
||||
)
|
||||
|> redirect(to: ~p"/sign-in")
|
||||
end
|
||||
|
||||
|
|
@ -224,10 +230,11 @@ defmodule MvWeb.AuthController do
|
|||
|> Enum.filter(fn {_key, value} -> not is_nil(value) end)
|
||||
end
|
||||
|
||||
defp safe_assent_meta(%{response: %{status_code: status_code}} = err) do
|
||||
# Handle InvalidResponseError which has :response field (HTTPResponse struct)
|
||||
defp safe_assent_meta(%{response: %{status: status} = response} = err) do
|
||||
[
|
||||
status_code: status_code,
|
||||
http_adapter: Map.get(err, :http_adapter)
|
||||
status: status,
|
||||
http_adapter: Map.get(response, :http_adapter) || Map.get(err, :http_adapter)
|
||||
]
|
||||
|> Enum.filter(fn {_key, value} -> not is_nil(value) end)
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue