Merge pull request #167 from fergyfresh/master

Adds logout to API endpoints demo project
This commit is contained in:
Maciej Jaworski 2016-02-23 11:07:26 +00:00
commit b34ef24dd7
5 changed files with 33 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 %}

View File

@ -13,6 +13,8 @@ Basic
- /rest-auth/logout/ (POST) - /rest-auth/logout/ (POST)
- token
- /rest-auth/password/reset/ (POST) - /rest-auth/password/reset/ (POST)
- email - email