]> git.0d.be Git - chloro.git/commitdiff
add authentication views
authorFrédéric Péters <fpeters@0d.be>
Sun, 29 Dec 2019 14:09:34 +0000 (15:09 +0100)
committerFrédéric Péters <fpeters@0d.be>
Mon, 30 Dec 2019 08:35:50 +0000 (09:35 +0100)
chloro/phyll/templates/registration/login.html [new file with mode: 0644]
chloro/settings.py
chloro/urls.py

diff --git a/chloro/phyll/templates/registration/login.html b/chloro/phyll/templates/registration/login.html
new file mode 100644 (file)
index 0000000..2e89da4
--- /dev/null
@@ -0,0 +1,11 @@
+{% extends "phyll/base.html" %}
+{% load i18n %}
+
+{% block body %}
+<form method="post" action="{% url 'login' %}">
+{% csrf_token %}
+{{ form.as_p }}
+<button name="login">{% trans "Login" %}</button>
+<input type="hidden" name="next" value="{{ next }}" />
+</form>
+{% endblock %}
index 4ee2cfe73a6c0f04d645242a6d0132bdb9823337..f3d06cd01ed09df45953f3afe0d6046c00ea04e0 100644 (file)
@@ -89,6 +89,8 @@ AUTH_PASSWORD_VALIDATORS = [
     {'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',},
 ]
 
+LOGIN_REDIRECT_URL = '/'
+LOGIN_URL = 'login'
 
 # Internationalization
 # https://docs.djangoproject.com/en/1.11/topics/i18n/
index 032add73e3e25d23200c82f6af2f154aac6bc832..d84a5e5ac2aeaea89658b27613a2e6353edae212 100644 (file)
 from django.conf import settings
 from django.conf.urls import include, url
 from django.conf.urls.static import static
+from django.contrib.auth import views as auth_views
 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
 
-urlpatterns = []
+urlpatterns = [
+    url(r'^accounts/login/$', auth_views.LoginView.as_view(), name='login'),
+    url(r'^accounts/logout/$', auth_views.LogoutView.as_view(), name='logout'),
+]
 
 # static and media files
 urlpatterns += staticfiles_urlpatterns()