mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2024-11-25 10:33:45 +03:00
Merge pull request #167 from fergyfresh/master
Adds logout to API endpoints demo project
This commit is contained in:
commit
b34ef24dd7
|
@ -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'),
|
||||||
|
|
|
@ -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>
|
||||||
|
|
20
demo/templates/fragments/logout_form.html
Normal file
20
demo/templates/fragments/logout_form.html
Normal 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 %}
|
8
demo/templates/logout.html
Normal file
8
demo/templates/logout.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="row">
|
||||||
|
<h3>Logout</h3><hr/>
|
||||||
|
{% include "fragments/logout_form.html" %}
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user