mirror of
https://github.com/penpot/penpot.git
synced 2025-03-21 04:01:24 -05:00
✨ Add parameter to disable registration
This commit is contained in:
parent
79f7d29df9
commit
e8bd7436aa
6 changed files with 14 additions and 2 deletions
backend/src/uxbox
frontend/src/uxbox/main
|
@ -56,6 +56,8 @@
|
|||
:smtp-ssl (lookup-env env :uxbox-smtp-ssl false)
|
||||
:smtp-enabled (lookup-env env :uxbox-smtp-enabled false)
|
||||
|
||||
:registration-enabled (lookup-env env :uxbox-registration-enabled true)
|
||||
|
||||
:secret (lookup-env env :uxbox-secret "5qjiAndGY3")})
|
||||
|
||||
(defn read-test-config
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
[buddy.sign.jwe :as jwe]
|
||||
[uxbox.sql :as sql]
|
||||
[uxbox.db :as db]
|
||||
[uxbox.config :as cfg]
|
||||
[uxbox.util.spec :as us]
|
||||
[uxbox.emails :as emails]
|
||||
[uxbox.services.core :as core]
|
||||
|
@ -186,8 +187,11 @@
|
|||
(defmethod core/novelty :register-profile
|
||||
[params]
|
||||
(s/assert ::register params)
|
||||
(with-open [conn (db/connection)]
|
||||
(sc/apply-atomic conn register-user params)))
|
||||
(if (= (:registration-enabled config) true)
|
||||
(with-open [conn (db/connection)]
|
||||
(sc/apply-atomic conn register-user params))
|
||||
(ex/raise :type :validation
|
||||
:code ::registration-disabled)))
|
||||
|
||||
;; --- Password Recover
|
||||
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
"history.alert-message" "You are seeing version %s"
|
||||
"errors.api.form.old-password-not-match" "Incorrect old password"
|
||||
"errors.api.form.registration-disabled" "The registration is currently disabled."
|
||||
"errors.api.form.email-already-exists" "The email is already in use by another user."
|
||||
"errors.api.form.username-already-exists" "The username is already in use by another user."
|
||||
"errors.api.form.user-not-exists" "Username or email does not matches any existing user."
|
||||
|
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
"history.alert-message" "Vous voyez la version %s"
|
||||
"errors.api.form.old-password-not-match" "Ancien mot de passe incorrect"
|
||||
"errors.api.form.registration-disabled" "L'enregistrement est actuellement désactivé."
|
||||
"errors.api.form.email-already-exists" "L'email est déjà utilisé par un autre utilisateur."
|
||||
"errors.api.form.username-already-exists" "Le nom d'utilisateur est déjà utilisé par un autre utilisateur."
|
||||
"errors.api.form.user-not-exists" "Le nom d'utilisateur ou l'e-mail ne correspond à aucun utilisateur existant."
|
||||
|
|
|
@ -51,6 +51,8 @@
|
|||
(st/emit! (assoc-value field value))))
|
||||
(on-error [{:keys [type code] :as payload}]
|
||||
(case code
|
||||
:uxbox.services.users/registration-disabled
|
||||
(st/emit! "Registration is disabled")
|
||||
:uxbox.services.users/email-already-exists
|
||||
(st/emit! (assoc-error :email "Email already exists"))
|
||||
:uxbox.services.users/username-already-exists
|
||||
|
|
|
@ -59,6 +59,8 @@
|
|||
(st/emit! (assoc-value field value))))
|
||||
(on-error [{:keys [code] :as payload}]
|
||||
(case code
|
||||
:uxbox.services.users/registration-disabled
|
||||
(st/emit! "Registration is disabled")
|
||||
:uxbox.services.users/email-already-exists
|
||||
(st/emit! (assoc-error :email "Email already exists"))
|
||||
:uxbox.services.users/username-already-exists
|
||||
|
|
Loading…
Add table
Reference in a new issue