mirror of
https://github.com/penpot/penpot.git
synced 2025-12-12 06:24:17 +01:00
Merge pull request #3298 from penpot/superalex-improve-invitations-validation
✨ Improve invitations validation
This commit is contained in:
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user