mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-26 10:00:33 +00:00
Reject registrations if not allowed by settings.
This commit is contained in:
parent
fffffc1f32
commit
e0a009a0f1
1 changed files with 4 additions and 0 deletions
|
@ -8,6 +8,7 @@ from django.core.files.base import ContentFile
|
|||
from django.http import HttpResponseBadRequest, HttpResponseNotFound
|
||||
from django.shortcuts import redirect
|
||||
from django.template.response import TemplateResponse
|
||||
from django.core.exceptions import PermissionDenied
|
||||
|
||||
from fedireads import books_manager
|
||||
from fedireads import forms, models, outgoing
|
||||
|
@ -49,6 +50,9 @@ def register(request):
|
|||
if request.method == 'GET':
|
||||
return redirect('/login')
|
||||
|
||||
if not models.SiteSettings.get().allow_registration:
|
||||
raise PermissionDenied
|
||||
|
||||
form = forms.RegisterForm(request.POST)
|
||||
if not form.is_valid():
|
||||
return redirect('/register/')
|
||||
|
|
Loading…
Reference in a new issue