From 041224e44b0a90025dd6ea72a519f925218ed487 Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Fri, 1 Mar 2024 13:53:57 +0100 Subject: [PATCH] :bug: Fix incorrect message trying to login with bad credentials --- frontend/src/app/main/ui/auth/login.cljs | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/frontend/src/app/main/ui/auth/login.cljs b/frontend/src/app/main/ui/auth/login.cljs index b48b9fd9c2..b4d02fb11e 100644 --- a/frontend/src/app/main/ui/auth/login.cljs +++ b/frontend/src/app/main/ui/auth/login.cljs @@ -100,26 +100,27 @@ :initial initial) on-error - (fn [cause] - (cond - (and (= :restriction (:type cause)) - (= :profile-blocked (:code cause))) - (reset! error (tr "errors.profile-blocked")) + (fn [err] + (let [cause (ex-data err)] + (cond + (and (= :restriction (:type cause)) + (= :profile-blocked (:code cause))) + (reset! error (tr "errors.profile-blocked")) - (and (= :restriction (:type cause)) - (= :admin-only-profile (:code cause))) - (reset! error (tr "errors.profile-blocked")) + (and (= :restriction (:type cause)) + (= :admin-only-profile (:code cause))) + (reset! error (tr "errors.profile-blocked")) - (and (= :validation (:type cause)) - (= :wrong-credentials (:code cause))) - (reset! error (tr "errors.wrong-credentials")) + (and (= :validation (:type cause)) + (= :wrong-credentials (:code cause))) + (reset! error (tr "errors.wrong-credentials")) - (and (= :validation (:type cause)) - (= :account-without-password (:code cause))) - (reset! error (tr "errors.wrong-credentials")) + (and (= :validation (:type cause)) + (= :account-without-password (:code cause))) + (reset! error (tr "errors.wrong-credentials")) - :else - (reset! error (tr "errors.generic")))) + :else + (reset! error (tr "errors.generic"))))) on-success-default (fn [data]