🐛 Hide registration screen when registration is disabled

This commit is contained in:
Andrés Moya 2021-02-22 17:11:51 +01:00 committed by Andrey Antukh
parent 002a6f1e52
commit 688d649c4a
7 changed files with 40 additions and 23 deletions

View file

@ -27,6 +27,7 @@
- Properly handle errors on github, gitlab and ldap auth backends. - Properly handle errors on github, gitlab and ldap auth backends.
- Properly mark profile auth backend (on first register/ auth with 3rd party auth provider). - Properly mark profile auth backend (on first register/ auth with 3rd party auth provider).
- Refactor LDAP auth backend. - Refactor LDAP auth backend.
- Hide register screen when registration is disabled [#598](https://github.com/penpot/penpot/issues/598)
### :heart: Community contributions by (Thank you!) ### :heart: Community contributions by (Thank you!)

View file

@ -7,3 +7,4 @@
//var penpotGitlabClientID = "<gitlab-client-id-here>"; //var penpotGitlabClientID = "<gitlab-client-id-here>";
//var penpotGithubClientID = "<github-client-id-here>"; //var penpotGithubClientID = "<github-client-id-here>";
//var penpotLoginWithLDAP = <true|false>; //var penpotLoginWithLDAP = <true|false>;
//var penpotRegistrationEnabled = <true|false>;

View file

@ -79,6 +79,16 @@ update_login_with_ldap() {
fi fi
} }
update_registration_enabled() {
if [ -n "$PENPOT_REGISTRATION_ENABLED" ]; then
log "Updating Registration Enabled: $PENPOT_REGISTRATION_ENABLED"
sed -i \
-e "s|^//var penpotRegistrationEnabled = .*;|var penpotRegistrationEnabled = $PENPOT_REGISTRATION_ENABLED;|g" \
"$1"
fi
}
update_public_uri /var/www/app/js/config.js update_public_uri /var/www/app/js/config.js
update_demo_warning /var/www/app/js/config.js update_demo_warning /var/www/app/js/config.js
update_allow_demo_users /var/www/app/js/config.js update_allow_demo_users /var/www/app/js/config.js
@ -86,5 +96,6 @@ update_google_client_id /var/www/app/js/config.js
update_gitlab_client_id /var/www/app/js/config.js update_gitlab_client_id /var/www/app/js/config.js
update_github_client_id /var/www/app/js/config.js update_github_client_id /var/www/app/js/config.js
update_login_with_ldap /var/www/app/js/config.js update_login_with_ldap /var/www/app/js/config.js
update_registration_enabled /var/www/app/js/config.js
exec "$@"; exec "$@";

View file

@ -34,7 +34,7 @@
"translations" : { "translations" : {
"ca" : "Crea un compte de proba", "ca" : "Crea un compte de proba",
"en" : "Create demo account", "en" : "Create demo account",
"es" : "Crear cuanta de prueba", "es" : "Crear cuenta de prueba",
"fr" : "Créer un compte de démonstration", "fr" : "Créer un compte de démonstration",
"ru" : "Хотите попробовать?", "ru" : "Хотите попробовать?",
"zh_cn" : "创建演示账号" "zh_cn" : "创建演示账号"

View file

@ -73,6 +73,7 @@
(def gitlab-client-id (obj/get global "penpotGitlabClientID" nil)) (def gitlab-client-id (obj/get global "penpotGitlabClientID" nil))
(def github-client-id (obj/get global "penpotGithubClientID" nil)) (def github-client-id (obj/get global "penpotGithubClientID" nil))
(def login-with-ldap (obj/get global "penpotLoginWithLDAP" false)) (def login-with-ldap (obj/get global "penpotLoginWithLDAP" false))
(def registration-enabled (obj/get global "penpotRegistrationEnabled" true))
(def worker-uri (obj/get global "penpotWorkerURI" "/js/worker.js")) (def worker-uri (obj/get global "penpotWorkerURI" "/js/worker.js"))
(def translations (obj/get global "penpotTranslations")) (def translations (obj/get global "penpotTranslations"))
(def themes (obj/get global "penpotThemes")) (def themes (obj/get global "penpotThemes"))

View file

@ -60,8 +60,10 @@
(def routes (def routes
[["/auth" [["/auth"
["/login" :auth-login] ["/login" :auth-login]
["/register" :auth-register] (when cfg/registration-enabled
["/register/success" :auth-register-success] ["/register" :auth-register])
(when cfg/registration-enabled
["/register/success" :auth-register-success])
["/recovery/request" :auth-recovery-request] ["/recovery/request" :auth-recovery-request]
["/recovery" :auth-recovery] ["/recovery" :auth-recovery]
["/verify-token" :auth-verify-token]] ["/verify-token" :auth-verify-token]]

View file

@ -145,11 +145,12 @@
:tab-index "5"} :tab-index "5"}
(tr "auth.forgot-password")]] (tr "auth.forgot-password")]]
(when cfg/registration-enabled
[:div.link-entry [:div.link-entry
[:span (tr "auth.register") " "] [:span (tr "auth.register") " "]
[:a {:on-click #(st/emit! (rt/nav :auth-register {} params)) [:a {:on-click #(st/emit! (rt/nav :auth-register {} params))
:tab-index "6"} :tab-index "6"}
(tr "auth.register-submit")]]] (tr "auth.register-submit")]])]
(when cfg/google-client-id (when cfg/google-client-id
[:a.btn-ocean.btn-large.btn-google-auth [:a.btn-ocean.btn-large.btn-google-auth