Skip to content
Snippets Groups Projects
Commit d4a783b6 authored by Dorian Lesbre's avatar Dorian Lesbre
Browse files

Added settings to close registrations

parent 2a591bfd
No related branches found
No related tags found
No related merge requests found
from django.shortcuts import render, redirect
from django.conf import settings
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.http import Http404
from django.shortcuts import render, redirect
from accounts.forms import CreateAccountForm
......@@ -12,6 +14,8 @@ def logout_view(request):
def create_account(request):
"""Vue pour l'inscription"""
if not settings.REGISTRATION_USER_CREATION_OPEN:
raise Http404("La création de compte n'est pas ouverte actuellement")
if request.method == 'POST':
form = CreateAccountForm(request.POST)
if form.is_valid():
......@@ -29,4 +33,4 @@ def create_account(request):
return redirect('home')
else:
form = CreateAccountForm()
return render(request, 'create_account.html', {'form': form})
return render(request, 'registration/create_account.html', {'form': form})
......@@ -129,3 +129,8 @@ STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
LOGIN_REDIRECT_URL = 'home'
# Blocks account creation when false
REGISTRATION_USER_CREATION_OPEN = True
# Blocks event inscription
REGISTRATION_EVENT_INSCRIPTIONS_OPEN = True
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment