From: Frédéric Péters Date: Sun, 29 Dec 2019 14:09:34 +0000 (+0100) Subject: add authentication views X-Git-Tag: v2022~56 X-Git-Url: https://git.0d.be/?p=chloro.git;a=commitdiff_plain;h=b72463af58122ee9d655a79c7fe2aa2d84649336 add authentication views --- diff --git a/chloro/phyll/templates/registration/login.html b/chloro/phyll/templates/registration/login.html new file mode 100644 index 0000000..2e89da4 --- /dev/null +++ b/chloro/phyll/templates/registration/login.html @@ -0,0 +1,11 @@ +{% extends "phyll/base.html" %} +{% load i18n %} + +{% block body %} +
+{% csrf_token %} +{{ form.as_p }} + + +
+{% endblock %} diff --git a/chloro/settings.py b/chloro/settings.py index 4ee2cfe..f3d06cd 100644 --- a/chloro/settings.py +++ b/chloro/settings.py @@ -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/ diff --git a/chloro/urls.py b/chloro/urls.py index 032add7..d84a5e5 100644 --- a/chloro/urls.py +++ b/chloro/urls.py @@ -17,9 +17,13 @@ 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()