mirror of
https://github.com/pinry/pinry.git
synced 2025-11-13 08:35:41 +01:00
Added some production settings. Moving to travis-ci for testing. Added feature to stop new registrations.
This commit is contained in:
@@ -5,6 +5,7 @@ from django.contrib.auth.decorators import login_required
|
||||
from django.contrib.auth import logout
|
||||
from django.contrib.auth.forms import UserCreationForm
|
||||
from django.contrib import messages
|
||||
from django.conf import settings
|
||||
|
||||
|
||||
def home(request):
|
||||
@@ -12,6 +13,10 @@ def home(request):
|
||||
|
||||
|
||||
def register(request):
|
||||
if not settings.ALLOW_NEW_REGISTRATIONS:
|
||||
messages.error(request, "The admin of this service is currently not "
|
||||
"allowing new users to register.")
|
||||
return HttpResponseRedirect(reverse('pins:recent-pins'))
|
||||
if request.method == 'POST':
|
||||
form = UserCreationForm(request.POST)
|
||||
if form.is_valid():
|
||||
@@ -21,6 +26,7 @@ def register(request):
|
||||
return HttpResponseRedirect(reverse('core:login'))
|
||||
else:
|
||||
form = UserCreationForm()
|
||||
|
||||
return TemplateResponse(request, 'core/register.html', {'form': form})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user