🎉 Add terms check to register

This commit is contained in:
elhombretecla 2021-03-02 11:48:51 +01:00 committed by Andrés Moya
parent 93311b8b98
commit 6c47df20af
8 changed files with 152 additions and 83 deletions

View file

@ -49,8 +49,10 @@
(declare register-profile)
(s/def ::invitation-token ::us/not-empty-string)
(s/def ::terms-privacy ::us/boolean)
(s/def ::register-profile
(s/keys :req-un [::email ::password ::fullname]
(s/keys :req-un [::email ::password ::fullname ::terms-privacy]
:opt-un [::invitation-token]))
(sv/defmethod ::register-profile {:auth false :rlimit :password}
@ -63,6 +65,10 @@
(ex/raise :type :validation
:code :email-domain-is-not-allowed))
(when-not (:terms-privacy params)
(ex/raise :type :validation
:code :invalid-terms-and-privacy))
(db/with-atomic [conn pool]
(let [cfg (assoc cfg :conn conn)]
(register-profile cfg params))))