mirror of
https://github.com/penpot/penpot.git
synced 2025-02-03 04:49:03 -05:00
✨ Trigger email verification on OIDC register process
This will happen only if: - the oidc provider properly reports that user has a non-verified email - the oidc does not provides any way to know the email verification status
This commit is contained in:
parent
b9ed0e1146
commit
ef632bcae7
1 changed files with 10 additions and 4 deletions
|
@ -20,7 +20,6 @@
|
||||||
[app.http.client :as http]
|
[app.http.client :as http]
|
||||||
[app.http.session :as session]
|
[app.http.session :as session]
|
||||||
[app.loggers.audit :as audit]
|
[app.loggers.audit :as audit]
|
||||||
[app.main :as-alias main]
|
|
||||||
[app.rpc.commands.profile :as profile]
|
[app.rpc.commands.profile :as profile]
|
||||||
[app.setup :as-alias setup]
|
[app.setup :as-alias setup]
|
||||||
[app.tokens :as tokens]
|
[app.tokens :as tokens]
|
||||||
|
@ -531,13 +530,21 @@
|
||||||
(->> (redirect-response uri)
|
(->> (redirect-response uri)
|
||||||
(sxf request)))
|
(sxf request)))
|
||||||
|
|
||||||
|
|
||||||
(if (auth/email-domain-in-whitelist? (:email info))
|
(if (auth/email-domain-in-whitelist? (:email info))
|
||||||
(let [info (assoc info
|
(let [info (assoc info
|
||||||
:iss :prepared-register
|
:iss :prepared-register
|
||||||
:is-active true
|
|
||||||
:exp (dt/in-future {:hours 48}))
|
:exp (dt/in-future {:hours 48}))
|
||||||
|
|
||||||
|
props (:props info)
|
||||||
|
info (if (or (:google/email_verified props)
|
||||||
|
(:github/email_verified props)
|
||||||
|
(:gitlab/email_verified props)
|
||||||
|
(:oidc/email_verified props))
|
||||||
|
(assoc info :is-active true)
|
||||||
|
info)
|
||||||
|
|
||||||
token (tokens/generate (::setup/props cfg) info)
|
token (tokens/generate (::setup/props cfg) info)
|
||||||
|
|
||||||
params (d/without-nils
|
params (d/without-nils
|
||||||
{:token token
|
{:token token
|
||||||
:fullname (:fullname info)})
|
:fullname (:fullname info)})
|
||||||
|
@ -548,7 +555,6 @@
|
||||||
(redirect-response uri))
|
(redirect-response uri))
|
||||||
(generate-error-redirect cfg "email-domain-not-allowed"))))
|
(generate-error-redirect cfg "email-domain-not-allowed"))))
|
||||||
|
|
||||||
|
|
||||||
(defn- auth-handler
|
(defn- auth-handler
|
||||||
[cfg {:keys [params] :as request}]
|
[cfg {:keys [params] :as request}]
|
||||||
(let [props (audit/extract-utm-params params)
|
(let [props (audit/extract-utm-params params)
|
||||||
|
|
Loading…
Add table
Reference in a new issue