0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-08 16:00:19 -05:00

🐛 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 mark profile auth backend (on first register/ auth with 3rd party auth provider).
- 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!)

View file

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

View file

@ -79,6 +79,16 @@ update_login_with_ldap() {
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_demo_warning /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_github_client_id /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 "$@";

View file

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

View file

@ -66,23 +66,24 @@
(def default-theme "default")
(def default-language "en")
(def demo-warning (obj/get global "penpotDemoWarning" false))
(def feedback-enabled (obj/get global "penpotFeedbackEnabled" false))
(def allow-demo-users (obj/get global "penpotAllowDemoUsers" true))
(def google-client-id (obj/get global "penpotGoogleClientID" nil))
(def gitlab-client-id (obj/get global "penpotGitlabClientID" nil))
(def github-client-id (obj/get global "penpotGithubClientID" nil))
(def login-with-ldap (obj/get global "penpotLoginWithLDAP" false))
(def worker-uri (obj/get global "penpotWorkerURI" "/js/worker.js"))
(def translations (obj/get global "penpotTranslations"))
(def themes (obj/get global "penpotThemes"))
(def demo-warning (obj/get global "penpotDemoWarning" false))
(def feedback-enabled (obj/get global "penpotFeedbackEnabled" false))
(def allow-demo-users (obj/get global "penpotAllowDemoUsers" true))
(def google-client-id (obj/get global "penpotGoogleClientID" nil))
(def gitlab-client-id (obj/get global "penpotGitlabClientID" nil))
(def github-client-id (obj/get global "penpotGithubClientID" nil))
(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 translations (obj/get global "penpotTranslations"))
(def themes (obj/get global "penpotThemes"))
(def public-uri (or (obj/get global "penpotPublicURI") (.-origin ^js location)))
(def public-uri (or (obj/get global "penpotPublicURI") (.-origin ^js location)))
(def version (delay (parse-version global)))
(def target (delay (parse-target global)))
(def browser (delay (parse-browser)))
(def platform (delay (parse-platform)))
(def version (delay (parse-version global)))
(def target (delay (parse-target global)))
(def browser (delay (parse-browser)))
(def platform (delay (parse-platform)))
(when (= :browser @target)
(js/console.log

View file

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

View file

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