From f86e080471bb34a52eb96eec05f80590ea7f7d23 Mon Sep 17 00:00:00 2001 From: Po Chen Date: Thu, 21 Jul 2022 18:44:24 +1000 Subject: [PATCH] Fix handling invalid client reason (#828) * Catch different reasons * redirect --- .../fz_http/lib/fz_http_web/controllers/auth_controller.ex | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apps/fz_http/lib/fz_http_web/controllers/auth_controller.ex b/apps/fz_http/lib/fz_http_web/controllers/auth_controller.ex index a8db0303e..54ba216fd 100644 --- a/apps/fz_http/lib/fz_http_web/controllers/auth_controller.ex +++ b/apps/fz_http/lib/fz_http_web/controllers/auth_controller.ex @@ -82,8 +82,11 @@ defmodule FzHttpWeb.AuthController do # Error verifying claims or fetching tokens {:error, action, reason} -> - Logger.warn("OpenIDConnect Error during #{action}: #{reason}") - send_resp(conn, 401, "") + Logger.warn("OpenIDConnect Error during #{action}: #{inspect(reason)}") + + conn + |> put_flash(:error, "Failed when performing this action: #{action}") + |> redirect(to: Routes.root_path(conn, :index)) end end