diff --git a/accounts/views.py b/accounts/views.py index 1abacb6efb4b15b21343ede7799a444de1f2be9c..db899e4cf2eddc422c85ee989d578d8a154b5bd4 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -1,6 +1,8 @@ -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}) diff --git a/interludes/settings.py b/interludes/settings.py index e82bcad327ebfe8ac51d35584f7bc44e3d222b52..81b4e78404ffe3c8a49bb094eabdbab6ec6c587f 100644 --- a/interludes/settings.py +++ b/interludes/settings.py @@ -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