mirror of
https://github.com/penpot/penpot.git
synced 2026-09-07 12:40:12 +00:00
✨ Improve invitations validation
This commit is contained in:
parent
6659ab110c
commit
8a9a3cbf37
@ -1,5 +1,7 @@
|
|||||||
# CHANGELOG
|
# CHANGELOG
|
||||||
|
|
||||||
|
## 1.18.5
|
||||||
|
|
||||||
## 1.18.4
|
## 1.18.4
|
||||||
|
|
||||||
### :bug: Bugs fixed
|
### :bug: Bugs fixed
|
||||||
|
|||||||
@ -169,14 +169,16 @@
|
|||||||
[{:keys [::db/pool] :as cfg} params]
|
[{:keys [::db/pool] :as cfg} params]
|
||||||
|
|
||||||
(when-not (contains? cf/flags :registration)
|
(when-not (contains? cf/flags :registration)
|
||||||
(if-not (contains? params :invitation-token)
|
(when-not (contains? params :invitation-token)
|
||||||
(ex/raise :type :restriction
|
(ex/raise :type :restriction
|
||||||
:code :registration-disabled)
|
:code :registration-disabled)))
|
||||||
(let [invitation (tokens/verify (::main/props cfg) {:token (:invitation-token params) :iss :team-invitation})]
|
|
||||||
(when-not (= (:email params) (:member-email invitation))
|
(when (contains? params :invitation-token)
|
||||||
(ex/raise :type :restriction
|
(let [invitation (tokens/verify (::main/props cfg) {:token (:invitation-token params) :iss :team-invitation})]
|
||||||
:code :email-does-not-match-invitation
|
(when-not (= (:email params) (:member-email invitation))
|
||||||
:hint "email should match the invitation")))))
|
(ex/raise :type :restriction
|
||||||
|
:code :email-does-not-match-invitation
|
||||||
|
:hint "email should match the invitation"))))
|
||||||
|
|
||||||
(when-let [domains (cf/get :registration-domain-whitelist)]
|
(when-let [domains (cf/get :registration-domain-whitelist)]
|
||||||
(when-not (email-domain-in-whitelist? domains (:email params))
|
(when-not (email-domain-in-whitelist? domains (:email params))
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
1.18.4
|
1.18.5
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user