diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-09-23 15:49:12 +0100 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-09-23 15:49:12 +0100 |
| commit | b4b241600704cf1be963a1ff51191eec020434a4 (patch) | |
| tree | 5bf05359e43afa46283c737e084a1208c7e028f5 | |
| parent | Bump version (diff) | |
| download | AnnotateChange-b4b241600704cf1be963a1ff51191eec020434a4.tar.gz AnnotateChange-b4b241600704cf1be963a1ff51191eec020434a4.zip | |
Add configuration option for accepting registrations
| -rw-r--r-- | app/auth/routes.py | 3 | ||||
| -rw-r--r-- | app/templates/auth/no_register.html | 17 | ||||
| -rw-r--r-- | config.py | 3 |
3 files changed, 23 insertions, 0 deletions
diff --git a/app/auth/routes.py b/app/auth/routes.py index 21b1a67..57bd605 100644 --- a/app/auth/routes.py +++ b/app/auth/routes.py @@ -133,6 +133,9 @@ def logout(): @bp.route("/register", methods=("GET", "POST")) def register(): + if not current_app.config['ACCEPTING_REGISTRATION']: + return render_template("auth/no_register.html") + if current_user.is_authenticated: return redirect(url_for("main.index")) form = RegistrationForm() diff --git a/app/templates/auth/no_register.html b/app/templates/auth/no_register.html new file mode 100644 index 0000000..9998e66 --- /dev/null +++ b/app/templates/auth/no_register.html @@ -0,0 +1,17 @@ +{% extends "base.html" %} +{% import 'bootstrap/wtf.html' as wtf %} + +{% block styles %} + {{ super() }} +{% endblock %} + +{% block app_content %} +<h1>Register</h1> +<div class="row"> + <div class="col-md-6"> + Thank you for your interest in AnnotateChange. We are not currently looking + for new annotators, so registration has been disabled. If you already have + an account, you can <a href="/auth/login">login here</a>. + </div> +</div> +{% endblock %} @@ -60,3 +60,6 @@ class Config(object): USER_EMAILS = os.environ.get("USER_EMAILS") or "" USER_EMAILS = [x.strip() for x in USER_EMAILS.split(";") if x.strip()] USER_EMAILS = None if not USER_EMAILS else USER_EMAILS + + # other + ACCEPTING_REGISTRATION = bool(int(os.environ.get('ACCEPTING_REGISTRATION', 0))) or False |
