mirror of
https://github.com/penpot/penpot.git
synced 2025-08-07 14:38:33 +02:00
✨ Validate confirmation email
This commit is contained in:
parent
68798522af
commit
a4c7215fa8
3 changed files with 50 additions and 35 deletions
|
@ -27,6 +27,15 @@
|
|||
|
||||
(s/def ::email-1 ::fm/email)
|
||||
(s/def ::email-2 ::fm/email)
|
||||
|
||||
(defn- email-equality
|
||||
[data]
|
||||
(let [email-1 (:email-1 data)
|
||||
email-2 (:email-2 data)]
|
||||
(cond-> {}
|
||||
(and email-1 email-2 (not= email-1 email-2))
|
||||
(assoc :email-2 {:message (tr "errors.email-invalid-confirmation")}))))
|
||||
|
||||
(s/def ::email-change-form
|
||||
(s/keys :req-un [::email-1 ::email-2]))
|
||||
|
||||
|
@ -59,6 +68,7 @@
|
|||
|
||||
[:& form {:on-submit on-submit
|
||||
:spec ::email-change-form
|
||||
:validators [email-equality]
|
||||
:initial {}}
|
||||
[:& input {:type "text"
|
||||
:name :email-1
|
||||
|
|
|
@ -54,8 +54,7 @@
|
|||
password-2 (:password-2 data)]
|
||||
|
||||
(cond-> {}
|
||||
(and password-1 password-2
|
||||
(not= password-1 password-2))
|
||||
(and password-1 password-2 (not= password-1 password-2))
|
||||
(assoc :password-2 {:message (tr "errors.password-invalid-confirmation")})
|
||||
|
||||
(and password-1 (> 8 (count password-1)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue