From 38c9e3e7cc320410367af460a08101f57b3eb5d8 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 9 Aug 2024 14:16:16 +0200 Subject: [PATCH] :bug: Fix error handling issue on login with oidc happens when no oidc backend is configured on backend --- frontend/src/app/main/ui/auth/login.cljs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/frontend/src/app/main/ui/auth/login.cljs b/frontend/src/app/main/ui/auth/login.cljs index 389a901f5..26004f0a6 100644 --- a/frontend/src/app/main/ui/auth/login.cljs +++ b/frontend/src/app/main/ui/auth/login.cljs @@ -55,14 +55,15 @@ (.replace js/location redirect-uri) (log/error :hint "unexpected response from OIDC method" :resp (pr-str rsp)))) - (fn [{:keys [type code] :as error}] - (cond - (and (= type :restriction) - (= code :provider-not-configured)) - (st/emit! (msg/error (tr "errors.auth-provider-not-configured"))) + (fn [cause] + (let [{:keys [type code] :as error} (ex-data cause)] + (cond + (and (= type :restriction) + (= code :provider-not-configured)) + (st/emit! (msg/error (tr "errors.auth-provider-not-configured"))) - :else - (st/emit! (msg/error (tr "errors.generic")))))))) + :else + (st/emit! (msg/error (tr "errors.generic"))))))))) (s/def ::email ::us/email) (s/def ::password ::us/not-empty-string)