From 7cbd2fe8dd6bd46ce8c860b6a1d2149f297ce6fe Mon Sep 17 00:00:00 2001 From: Henrik Mildner Date: Fri, 17 Jan 2025 17:48:55 +0100 Subject: [PATCH] Added User Authentification and static/css/login.css --- .../templates/registration/login.html | 24 +++++++++++++++++++ core/accounts/urls.py | 6 ++++- core/accounts/views.py | 2 ++ static/css/login.css | 4 ++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 core/accounts/templates/registration/login.html create mode 100644 static/css/login.css diff --git a/core/accounts/templates/registration/login.html b/core/accounts/templates/registration/login.html new file mode 100644 index 0000000..8919c66 --- /dev/null +++ b/core/accounts/templates/registration/login.html @@ -0,0 +1,24 @@ +{% load static %} + + + + + + Login + + + +
+
+ {% csrf_token %} +
+ +
+
+ +
+ +
+
+ + \ No newline at end of file diff --git a/core/accounts/urls.py b/core/accounts/urls.py index 6a2709e..f4aab15 100644 --- a/core/accounts/urls.py +++ b/core/accounts/urls.py @@ -1,6 +1,10 @@ from django.urls import path # type: ignore from . import views +from django.contrib.auth.views import LogoutView +from django.contrib.auth.views import LoginView urlpatterns = [ - path('', views.home) + path('', views.home), + path('logout/', LogoutView.as_view(), name='logout'), + path('accounts/login/', LoginView.as_view(), name='login'), ] \ No newline at end of file diff --git a/core/accounts/views.py b/core/accounts/views.py index d622f30..e9c0b0d 100644 --- a/core/accounts/views.py +++ b/core/accounts/views.py @@ -1,5 +1,7 @@ from django.shortcuts import render +from django.contrib.auth.decorators import login_required # Create your views here. +@login_required def home(request): return render(request, 'accounts/home.html') diff --git a/static/css/login.css b/static/css/login.css new file mode 100644 index 0000000..101ffc5 --- /dev/null +++ b/static/css/login.css @@ -0,0 +1,4 @@ +/*This is the Stylesheet for the Login Screen*/ +body { + background-color: #da1f3d; +} \ No newline at end of file