Skip to content
Snippets Groups Projects
Commit 240bdb42 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

Prevent account creation when authenticated

parent fe070ddf
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ from django.contrib.auth.forms import PasswordChangeForm ...@@ -9,6 +9,7 @@ from django.contrib.auth.forms import PasswordChangeForm
from django.core.mail import send_mail from django.core.mail import send_mail
from django.db.models import ProtectedError from django.db.models import ProtectedError
from django.forms import widgets from django.forms import widgets
from django.http import HttpResponseForbidden
from django.shortcuts import render, redirect from django.shortcuts import render, redirect
from django.template import TemplateDoesNotExist from django.template import TemplateDoesNotExist
from django.utils.translation import ugettext from django.utils.translation import ugettext
...@@ -82,6 +83,8 @@ def signup(request): ...@@ -82,6 +83,8 @@ def signup(request):
login(request, user) login(request, user)
return redirect('home') return redirect('home')
else: else:
if not request.user.is_anonymous:
return HttpResponseForbidden()
form = UserCreationFormWithMore() form = UserCreationFormWithMore()
return render(request, 'registration/signup.html', {'form': form}) return render(request, 'registration/signup.html', {'form': form})
......
{% load i18n %}
<!-- **** Begin Fork-Me-On-Gitlab-Ribbon-HTML. See MIT License at https://gitlab.com/seanwasere/fork-me-on-gitlab **** -->
<a href="https://gitlab.pasteur.fr/bbrancot/django-basetheme-bootstrap">
<span class="fork_me">{%trans "Fork Me"%}</span>
</a>
<!-- **** End Fork-Me-On-Gitlab-Ribbon-HTML **** -->
\ No newline at end of file
{% load basetheme_bootstrap %}
{% load i18n %}
<li class="nav-item"><a class="nav-link" href="/"><i class="fa fa-table"></i> Theme BS4</a></li>
<li class="nav-item"><a class="nav-link" href="/themePasteur"><i class="fa fa-map-signs"></i> Theme BS4 Pasteur</a></li>
<li class="nav-item {{ request|is_active_or_desc:'basetheme_bootstrap:about_page'}}"><a href="{% url 'basetheme_bootstrap:about_page'%}" class="nav-link">{%trans "About"%}</a></li>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment