auth related minor changes

This commit is contained in:
Élie Bouttier 2016-06-12 18:47:26 +02:00
parent 4665fca257
commit dab6bf83f9
5 changed files with 10 additions and 22 deletions

View File

@ -1,21 +0,0 @@
{% extends 'base.html' %}
{% load bootstrap3 %}
{% block content %}
<div class="page-header">
<h1>
Logout
</h1>
</div>
<div class="row">
<div class="col-md-offset-4 col-md-4">
<div class="well">
<p>You are not logged in anymore. <a href="{% url 'login' %}">Login again ?</a></p>
</div>
</div>
</div>
{% endblock %}

View File

@ -26,4 +26,10 @@
</div>
</div>
<div class="row">
<div class="col-md-offset-4 col-md-4">
You do not have an account? Please <a href="{% url 'registration_register' %}">register</a>.
</div>
</div>
{% endblock %}

View File

@ -18,7 +18,7 @@
{% csrf_token %}
<div class="form-group text-center">
<button type="submit" class="btn btn-primary">Submit</button>
<a href="{% if request.GET.prev %}{{ request.GET.prev }}{% else %}{% url 'home' %}{% endif %}" class="btn btn-default">Cancel</a>
<a href="{% if request.GET.prev %}{{ request.GET.prev }}{% else %}{% url 'profile' %}{% endif %}" class="btn btn-default">Cancel</a>
</div>
</form>
</div>

View File

@ -1,8 +1,10 @@
from django.conf.urls import include, url
from django.contrib.auth import views as auth_views
from .views import profile
urlpatterns = [
url(r'^profile$', profile, name='profile'),
url(r'^logout/$', auth_views.logout, {'next_page': '/'}, name='logout'),
url(r'', include('django.contrib.auth.urls')),
]

View File

@ -59,6 +59,7 @@
<li><a href="{% url 'logout' %}" data-toggle="tooltip" data-placement="bottom" title="Logout"><span class="glyphicon glyphicon-log-out"></span></a></li>
{% else %}
<li><a href="{% url 'login' %}?next={{ request.path }}"><span class="glyphicon glyphicon-log-in"></span>&nbsp;Login</a></li>
<li><a href="{% url 'registration_register' %}"><span class="glyphicon glyphicon-edit"></span>&nbsp;Register</a></li>
{% endif %}
</ul>
{% block navbar-right %}{% endblock %}