Added logout functionality to demo project

This commit is contained in:
Billy Ferguson 2016-02-08 17:14:25 -05:00
parent 7c8a34f700
commit 8d91e1881e
4 changed files with 31 additions and 0 deletions

View File

@ -11,6 +11,8 @@ urlpatterns = [
name='email-verification'), name='email-verification'),
url(r'^login/$', TemplateView.as_view(template_name="login.html"), url(r'^login/$', TemplateView.as_view(template_name="login.html"),
name='login'), name='login'),
url(r'^logout/$', TemplateView.as_view(template_name="logout.html"),
name='logout'),
url(r'^password-reset/$', url(r'^password-reset/$',
TemplateView.as_view(template_name="password_reset.html"), TemplateView.as_view(template_name="password_reset.html"),
name='password-reset'), name='password-reset'),

View File

@ -40,6 +40,7 @@
<li class="divider"></li> <li class="divider"></li>
<!-- these pages require user token --> <!-- these pages require user token -->
<li><a href="{% url 'user-details' %}">User details</a></li> <li><a href="{% url 'user-details' %}">User details</a></li>
<li><a href="{% url 'logout' %}">Logout</a></li>
<li><a href="{% url 'password-change' %}">Password change</a></li> <li><a href="{% url 'password-change' %}">Password change</a></li>
</ul> </ul>
</li> </li>

View File

@ -0,0 +1,20 @@
{% block content %}
<form class="form-horizontal ajax-post" role="form" action="{% url 'rest_logout' %}">{% csrf_token %}
<div class="form-group">
<label for="token" class="col-sm-2 control-label">User Token</label>
<div class="col-sm-4">
<input name="token" type="text" class="form-control" id="token" placeholder="Token">
<p class="help-block">Token received after login</p>
</div>
</div>
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
<button type="submit" class="btn btn-default">Login</button>
</div>
</div>
<div class="form-group api-response"></div>
</form>
{% endblock %}

View File

@ -0,0 +1,8 @@
{% extends "base.html" %}
{% block content %}
<div class="row">
<h3>Logout</h3><hr/>
{% include "fragments/logout_form.html" %}
</div>
{% endblock %}