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"
default = 2
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")
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)
if not form.is_valid():
context["form"] = form

Loading…
Cancel
Save