Add setting to disable registration

pull/1/head
Luca 2 years ago
parent 2659273824
commit 7c5c110283

@ -56,3 +56,10 @@ class SMSRate(types.IntegerPreference):
name = "sms_rate" name = "sms_rate"
default = 2 default = 2
help_text = "Number of SMS sent per minute" help_text = "Number of SMS sent per minute"
@global_preferences_registry.register
class EnableRegistration(types.BooleanPreference):
section = helper
name = "enable_registration"
default = True

@ -119,7 +119,13 @@ def register(request):
return redirect("index") return redirect("index")
context = {} context = {}
if request.method == "POST": if not global_preferences["helper__enable_registration"]:
messages.add_message(
request,
messages.WARNING if request.method == "POST" else messages.INFO,
"Aktuell ist es leider nicht möglich, sich für die Helfer*innen zu registrieren. Bitte komm später wieder.",
)
elif request.method == "POST":
form = RegisterForm(request.POST) form = RegisterForm(request.POST)
if not form.is_valid(): if not form.is_valid():
context["form"] = form context["form"] = form

Loading…
Cancel
Save