merge conflict resolved
This commit is contained in:
commit
70f62f4af1
3 changed files with 17 additions and 6 deletions
|
@ -14,8 +14,8 @@
|
|||
{% if form.errors %}
|
||||
<p class="error">Identifiants incorrects.</p>
|
||||
{% endif %}
|
||||
|
||||
<form class="form-horizontal" method="post" action="{% url 'gestioncof.views.login_ext' %}">
|
||||
<form class="form-horizontal" method="post"
|
||||
action="{% url 'gestioncof.views.login_ext' %}?next={{ next|urlencode }}">
|
||||
{% csrf_token %}
|
||||
<div class="form-group">
|
||||
<input class="form-control" id="id_username" maxlength="254" name="username" type="text" placeholder="Nom d'utilisateur">
|
||||
|
|
|
@ -11,12 +11,14 @@
|
|||
</header>
|
||||
<div class="container-fluid">
|
||||
<div class="row" style="margin:0;">
|
||||
<a aria-label="Compte clipper" href="{% url 'django_cas_ng.views.login' %}">
|
||||
<a aria-label="Compte clipper"
|
||||
href="{% url 'django_cas_ng.views.login' %}?next={{ next|urlencode }}">
|
||||
<div class="col-xs-12 col-sm-6" id="login_clipper">
|
||||
Compte clipper
|
||||
</div>
|
||||
</a>
|
||||
<a aria-label="Extérieur" href="{% url 'gestioncof.views.login_ext' %}">
|
||||
<a aria-label="Extérieur"
|
||||
href="{% url 'gestioncof.views.login_ext' %}?next={{ next|urlencode }}">
|
||||
<div class="col-xs-12 col-sm-6" id="login_outsider">
|
||||
Extérieur
|
||||
</div>
|
||||
|
|
|
@ -43,7 +43,10 @@ def home(request):
|
|||
def login(request):
|
||||
if request.user.is_authenticated():
|
||||
return redirect("gestioncof.views.home")
|
||||
return render(request, "login_switch.html", {})
|
||||
context = {}
|
||||
if request.method == "GET" and 'next' in request.GET:
|
||||
context['next'] = request.GET['next']
|
||||
return render(request, "login_switch.html", context)
|
||||
|
||||
|
||||
def login_ext(request):
|
||||
|
@ -60,7 +63,13 @@ def login_ext(request):
|
|||
{"error_type": "no_password"})
|
||||
except User.DoesNotExist:
|
||||
pass
|
||||
return django_login_view(request, template_name='login.html')
|
||||
context = {}
|
||||
if request.method == "GET" and 'next' in request.GET:
|
||||
context['next'] = request.GET['next']
|
||||
if request.method == "POST" and 'next' in request.POST:
|
||||
context['next'] = request.POST['next']
|
||||
return django_login_view(request, template_name='login.html',
|
||||
extra_context=context)
|
||||
|
||||
|
||||
@login_required
|
||||
|
|
Loading…
Reference in a new issue