2
0
Fork 0

Add setting to disable registration

This commit is contained in:
Luca 2023-04-26 12:15:50 +02:00
parent 2659273824
commit 7c5c110283
2 changed files with 14 additions and 1 deletions

View File

@ -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

View File

@ -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