Add authentication app

This commit is contained in:
Gabriel Augendre 2016-06-03 19:33:51 +02:00
parent f4516604bf
commit e96c272572
No known key found for this signature in database
GPG key ID: D2B6A5B41FC438B1
5 changed files with 38 additions and 0 deletions

View file

5
authentication/apps.py Normal file
View file

@ -0,0 +1,5 @@
from django.apps import AppConfig
class AuthenticationConfig(AppConfig):
name = 'authentication'

View file

View file

@ -0,0 +1,18 @@
{% extends 'base.html' %}
{% load staticfiles %}
{% load crispy_forms_filters %}
{% block content %}
<h1>{% block title %}Login{% endblock %}</h1>
<div id="login">
<form name="LoginForm" action="{% url 'auth_login' %}" method="post">
{% if next %}
<input type="hidden" name="next" value="{{ next }}"/>
{% endif %}
{% csrf_token %}
{{ form|crispy }}
<button type="submit" class="btn btn-primary">Login</button>
</form>
</div>
{% endblock %}

15
authentication/urls.py Normal file
View file

@ -0,0 +1,15 @@
from django.conf.urls import url
from django.contrib.auth.views import login, logout
urlpatterns = [
url(r'^login/$',
login,
{'template_name': 'authentication/login.html'},
name='auth_login'
),
url(r'^logout/$',
logout,
{'next_page': 'blog_home'},
name='auth_logout'
),
]