mirror of
https://github.com/penpot/penpot.git
synced 2025-02-12 18:18:24 -05:00
✨ Show error notificaton on oidc error redirect
This commit is contained in:
parent
81b52d7170
commit
fd92437f7d
5 changed files with 47 additions and 3 deletions
|
@ -91,7 +91,6 @@
|
||||||
{:props (db/tjson props)}
|
{:props (db/tjson props)}
|
||||||
{:id profile-id}))
|
{:id profile-id}))
|
||||||
|
|
||||||
|
|
||||||
(let [profile (assoc profile :props props)]
|
(let [profile (assoc profile :props props)]
|
||||||
(assoc claims :profile profile))))
|
(assoc claims :profile profile))))
|
||||||
|
|
||||||
|
|
|
@ -15,10 +15,11 @@
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.main.data.events :as ev]
|
[app.main.data.events :as ev]
|
||||||
[app.main.data.media :as di]
|
[app.main.data.media :as di]
|
||||||
|
[app.main.data.messages :as msg]
|
||||||
[app.main.data.websocket :as ws]
|
[app.main.data.websocket :as ws]
|
||||||
[app.main.features :as features]
|
[app.main.features :as features]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.util.i18n :as i18n]
|
[app.util.i18n :as i18n :refer [tr]]
|
||||||
[app.util.router :as rt]
|
[app.util.router :as rt]
|
||||||
[app.util.storage :refer [storage]]
|
[app.util.storage :refer [storage]]
|
||||||
[beicon.v2.core :as rx]
|
[beicon.v2.core :as rx]
|
||||||
|
@ -683,3 +684,24 @@
|
||||||
(->> (rp/cmd! :delete-access-token params)
|
(->> (rp/cmd! :delete-access-token params)
|
||||||
(rx/tap on-success)
|
(rx/tap on-success)
|
||||||
(rx/catch on-error))))))
|
(rx/catch on-error))))))
|
||||||
|
|
||||||
|
(defn show-redirect-error
|
||||||
|
"A helper event that interprets the OIDC redirect errors on the URI
|
||||||
|
and shows an appropriate error message using the notification
|
||||||
|
banners."
|
||||||
|
[error]
|
||||||
|
(ptk/reify ::show-redirect-error
|
||||||
|
ptk/WatchEvent
|
||||||
|
(watch [_ _ _]
|
||||||
|
(let [hint (case error
|
||||||
|
"registration-disabled"
|
||||||
|
(tr "errors.registration-disabled")
|
||||||
|
"profile-blocked"
|
||||||
|
(tr "errors.profile-blocked")
|
||||||
|
"auth-provider-not-allowed"
|
||||||
|
(tr "errors.auth-provider-not-allowed")
|
||||||
|
"email-domain-not-allowed"
|
||||||
|
(tr "errors.email-domain-not-allowed")
|
||||||
|
:else
|
||||||
|
(tr "errors.generic"))]
|
||||||
|
(rx/of (msg/warn hint))))))
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
(:require
|
(:require
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
|
[app.main.data.users :as du]
|
||||||
|
[app.main.store :as st]
|
||||||
[app.main.ui.auth.login :refer [login-page]]
|
[app.main.ui.auth.login :refer [login-page]]
|
||||||
[app.main.ui.auth.recovery :refer [recovery-page]]
|
[app.main.ui.auth.recovery :refer [recovery-page]]
|
||||||
[app.main.ui.auth.recovery-request :refer [recovery-request-page]]
|
[app.main.ui.auth.recovery-request :refer [recovery-request-page]]
|
||||||
|
@ -42,11 +44,16 @@
|
||||||
{::mf/props :obj}
|
{::mf/props :obj}
|
||||||
[{:keys [route]}]
|
[{:keys [route]}]
|
||||||
(let [section (dm/get-in route [:data :name])
|
(let [section (dm/get-in route [:data :name])
|
||||||
params (:query-params route)]
|
params (:query-params route)
|
||||||
|
error (:error params)]
|
||||||
|
|
||||||
(mf/with-effect []
|
(mf/with-effect []
|
||||||
(dom/set-html-title (tr "title.default")))
|
(dom/set-html-title (tr "title.default")))
|
||||||
|
|
||||||
|
(mf/with-effect [error]
|
||||||
|
(when error
|
||||||
|
(st/emit! (du/show-redirect-error error))))
|
||||||
|
|
||||||
[:main {:class (stl/css :auth-section)}
|
[:main {:class (stl/css :auth-section)}
|
||||||
[:a {:href "#/" :class (stl/css :logo-btn)} i/logo]
|
[:a {:href "#/" :class (stl/css :logo-btn)} i/logo]
|
||||||
[:div {:class (stl/css :login-illustration)}
|
[:div {:class (stl/css :login-illustration)}
|
||||||
|
|
|
@ -968,6 +968,14 @@ msgstr "Your profile has emails muted (spam reports or high bounces)."
|
||||||
msgid "errors.registration-disabled"
|
msgid "errors.registration-disabled"
|
||||||
msgstr "The registration is currently disabled."
|
msgstr "The registration is currently disabled."
|
||||||
|
|
||||||
|
#: src/app/main/data/users.cljs
|
||||||
|
msgid "errors.auth-provider-not-allowed"
|
||||||
|
msgstr "Auth provider not allowed for this profile"
|
||||||
|
|
||||||
|
#: src/app/main/data/users.cljs
|
||||||
|
msgid "errors.email-domain-not-allowed"
|
||||||
|
msgstr "Domain not allowed"
|
||||||
|
|
||||||
msgid "errors.team-leave.insufficient-members"
|
msgid "errors.team-leave.insufficient-members"
|
||||||
msgstr "Insufficient members to leave team, you probably want to delete it."
|
msgstr "Insufficient members to leave team, you probably want to delete it."
|
||||||
|
|
||||||
|
|
|
@ -991,6 +991,14 @@ msgstr ""
|
||||||
msgid "errors.registration-disabled"
|
msgid "errors.registration-disabled"
|
||||||
msgstr "El registro está actualmente desactivado."
|
msgstr "El registro está actualmente desactivado."
|
||||||
|
|
||||||
|
#: src/app/main/data/users.cljs
|
||||||
|
msgid "errors.auth-provider-not-allowed"
|
||||||
|
msgstr "El proveedor de autenticación no permitido para este perfil de usuario"
|
||||||
|
|
||||||
|
#: src/app/main/data/users.cljs
|
||||||
|
msgid "errors.email-domain-not-allowed"
|
||||||
|
msgstr "Dominio no permitido"
|
||||||
|
|
||||||
msgid "errors.team-leave.insufficient-members"
|
msgid "errors.team-leave.insufficient-members"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"No hay miembros suficientes para salir del equipo, probablemente quieras "
|
"No hay miembros suficientes para salir del equipo, probablemente quieras "
|
||||||
|
|
Loading…
Add table
Reference in a new issue