From 2d75efbacef306f821a468e22c46082d46bc514f Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 6 May 2021 17:41:42 +0200 Subject: [PATCH] :bug: Add correct error mesage when using an expired token. --- .../src/app/main/ui/auth/verify_token.cljs | 16 ++++++-- frontend/translations/en.po | 37 +++++++------------ frontend/translations/es.po | 4 ++ 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/frontend/src/app/main/ui/auth/verify_token.cljs b/frontend/src/app/main/ui/auth/verify_token.cljs index a926cf85b..b24521f09 100644 --- a/frontend/src/app/main/ui/auth/verify_token.cljs +++ b/frontend/src/app/main/ui/auth/verify_token.cljs @@ -74,18 +74,26 @@ (rx/subs (fn [tdata] (handle-token tdata)) - (fn [error] - (case (:code error) - :email-already-exists + (fn [{:keys [type code] :as error}] + (cond + (and (= :validation type) + (= :invalid-token code) + (= :token-expired (:reason error))) + (let [msg (tr "errors.token-expired")] + (ts/schedule 100 #(st/emit! (dm/error msg))) + (st/emit! (rt/nav :auth-login))) + + (= :email-already-exists code) (let [msg (tr "errors.email-already-exists")] (ts/schedule 100 #(st/emit! (dm/error msg))) (st/emit! (rt/nav :auth-login))) - :email-already-validated + (= :email-already-validated code) (let [msg (tr "errors.email-already-validated")] (ts/schedule 100 #(st/emit! (dm/warn msg))) (st/emit! (rt/nav :auth-login))) + :else (let [msg (tr "errors.generic")] (ts/schedule 100 #(st/emit! (dm/error msg))) (st/emit! (rt/nav :auth-login))))))))) diff --git a/frontend/translations/en.po b/frontend/translations/en.po index eb0eee9d9..6fb62455c 100644 --- a/frontend/translations/en.po +++ b/frontend/translations/en.po @@ -1,25 +1,16 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR Free Software Foundation, Inc. -# FIRST AUTHOR , YEAR. -# -#, fuzzy msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"PO-Revision-Date: 2021-04-22 13:43+0200\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" +"PO-Revision-Date: 2021-04-14 13:44+0000\n" +"Last-Translator: Andrés Moya \n" +"Language-Team: English " +"\n" +"Language: en\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=iso-8859-1\n" +"Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.6-dev\n" -# ~ msgid "" -# ~ msgstr "" -# ~ "Language: en\n" -# ~ "MIME-Version: 1.0\n" -# ~ "Content-Type: text/plain; charset=utf-8\n" -# ~ "Content-Transfer-Encoding: 8bit\n" -# ~ "Plural-Forms: nplurals=2; plural=(n != 1);\n" #: src/app/main/ui/auth/register.cljs msgid "auth.already-have-account" msgstr "Already have an account?" @@ -492,6 +483,10 @@ msgstr "The registration is currently disabled." msgid "errors.terms-privacy-agreement-invalid" msgstr "You must accept our terms of service and privacy policy." +#: src/app/main/ui/auth/verify_token.cljs +msgid "errors.token-expired" +msgstr "Token expired" + #: src/app/main/data/media.cljs, src/app/main/ui/workspace/sidebar/options/menus/exports.cljs, src/app/main/ui/handoff/exports.cljs msgid "errors.unexpected-error" msgstr "An unexpected error occurred." @@ -1068,9 +1063,7 @@ msgstr "Verify new email" #: src/app/main/ui/settings/change_email.cljs msgid "modals.change-email.info" -msgstr "" -"We'll send you an email to your current email “%s” to verify your " -"identity." +msgstr "We'll send you an email to your current email “%s” to verify your identity." #: src/app/main/ui/settings/change_email.cljs msgid "modals.change-email.new-email" @@ -1094,9 +1087,7 @@ msgstr "Yes, delete my account" #: src/app/main/ui/settings/delete_account.cljs msgid "modals.delete-account.info" -msgstr "" -"By removing your account you’ll lose all your current projects and " -"archives." +msgstr "By removing your account you’ll lose all your current projects and archives." #: src/app/main/ui/settings/delete_account.cljs msgid "modals.delete-account.title" diff --git a/frontend/translations/es.po b/frontend/translations/es.po index 46bacd4eb..44078530f 100644 --- a/frontend/translations/es.po +++ b/frontend/translations/es.po @@ -494,6 +494,10 @@ msgstr "El registro está actualmente desactivado." msgid "errors.terms-privacy-agreement-invalid" msgstr "Debes aceptar nuestros términos de servicio y política de privacidad." +#: src/app/main/ui/auth/verify_token.cljs +msgid "errors.token-expired" +msgstr "Token expirado" + #: src/app/main/data/media.cljs, src/app/main/ui/workspace/sidebar/options/menus/exports.cljs, src/app/main/ui/handoff/exports.cljs msgid "errors.unexpected-error" msgstr "Ha ocurrido un error inesperado."