From d19eb748d2a40cb92ef6d6af690f52f84f32360f Mon Sep 17 00:00:00 2001 From: benjaminramey Date: Sun, 14 Mar 2021 21:28:23 -0500 Subject: [PATCH] Login page! --- forgetmenot/settings.py | 4 +- forgetmenot/templates/base.html | 2 + forgetmenot/templates/registration/login.html | 38 +++++++++++++++++++ forgetmenot/urls.py | 1 + 4 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 forgetmenot/templates/base.html create mode 100644 forgetmenot/templates/registration/login.html diff --git a/forgetmenot/settings.py b/forgetmenot/settings.py index b084e27..cd97ab2 100644 --- a/forgetmenot/settings.py +++ b/forgetmenot/settings.py @@ -55,7 +55,9 @@ ROOT_URLCONF = 'forgetmenot.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], + 'DIRS': [ + 'forgetmenot/templates' + ], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ diff --git a/forgetmenot/templates/base.html b/forgetmenot/templates/base.html new file mode 100644 index 0000000..c6afe66 --- /dev/null +++ b/forgetmenot/templates/base.html @@ -0,0 +1,2 @@ +{% block content %} +{% endblock %} \ No newline at end of file diff --git a/forgetmenot/templates/registration/login.html b/forgetmenot/templates/registration/login.html new file mode 100644 index 0000000..1d89636 --- /dev/null +++ b/forgetmenot/templates/registration/login.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block content %} + +{% if form.errors %} +

Your username and password didn't match. Please try again.

+{% endif %} + +{% if next %} + {% if user.is_authenticated %} +

Your account doesn't have access to this page. To proceed, + please login with an account that has access.

+ {% else %} +

Please login to see this page.

+ {% endif %} +{% endif %} + +
+{% csrf_token %} + + + + + + + + + +
{{ form.username.label_tag }}{{ form.username }}
{{ form.password.label_tag }}{{ form.password }}
+ + + +
+ +{# Assumes you setup the password_reset view in your URLconf #} +

Lost password?

+ +{% endblock %} \ No newline at end of file diff --git a/forgetmenot/urls.py b/forgetmenot/urls.py index 2dbc13a..7ed22b8 100644 --- a/forgetmenot/urls.py +++ b/forgetmenot/urls.py @@ -19,4 +19,5 @@ from django.urls import include, path urlpatterns = [ path('bookmarks/', include('bookmarks.urls')), path('admin/', admin.site.urls), + path('accounts/', include('django.contrib.auth.urls')) ]