From f5bf77fbed69ed262a92b37ef441de847fa7cef6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20M=C3=BCller?= <9070224-W13R@users.noreply.gitlab.com> Date: Sat, 6 Aug 2022 17:33:31 +0200 Subject: [PATCH 1/3] Added auto-reload after 2 minutes when logged in, to force auto-logout --- application/app/templates/deposit.html | 1 + application/app/templates/history.html | 2 ++ application/app/templates/index.html | 2 ++ application/app/templates/order.html | 2 ++ application/app/templates/statistics.html | 2 ++ static/js/autoreload.js | 3 +++ 6 files changed, 12 insertions(+) create mode 100644 static/js/autoreload.js diff --git a/application/app/templates/deposit.html b/application/app/templates/deposit.html index 1093070..dac6950 100644 --- a/application/app/templates/deposit.html +++ b/application/app/templates/deposit.html @@ -35,5 +35,6 @@ + {% endblock %} diff --git a/application/app/templates/history.html b/application/app/templates/history.html index cdfa78f..ff43b23 100644 --- a/application/app/templates/history.html +++ b/application/app/templates/history.html @@ -32,5 +32,7 @@ {% else %} {% translate "No history." %} {% endif %} + + {% endblock %} diff --git a/application/app/templates/index.html b/application/app/templates/index.html index c639390..9836e32 100644 --- a/application/app/templates/index.html +++ b/application/app/templates/index.html @@ -44,4 +44,6 @@ {% endif %} + + {% endblock %} diff --git a/application/app/templates/order.html b/application/app/templates/order.html index 2f1d58f..5c72755 100644 --- a/application/app/templates/order.html +++ b/application/app/templates/order.html @@ -97,4 +97,6 @@ {% endif %} + + {% endblock %} diff --git a/application/app/templates/statistics.html b/application/app/templates/statistics.html index 9d26016..cc340fd 100644 --- a/application/app/templates/statistics.html +++ b/application/app/templates/statistics.html @@ -146,4 +146,6 @@ + + {% endblock %} diff --git a/static/js/autoreload.js b/static/js/autoreload.js new file mode 100644 index 0000000..0c30078 --- /dev/null +++ b/static/js/autoreload.js @@ -0,0 +1,3 @@ +setInterval(() => { + location.reload(); +}, 1000*60*2); // reload after 2 minutes \ No newline at end of file -- 2.43.0 From ca160781dd6702aacae1f0d91b8bfb9b6c87df01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian=20M=C3=BCller?= <9070224-W13R@users.noreply.gitlab.com> Date: Sat, 6 Aug 2022 18:56:39 +0200 Subject: [PATCH 2/3] Added support for profile pictures --- application/app/admin.py | 11 +++++--- application/app/models.py | 1 + .../app/templates/registration/login.html | 24 ++++++++-------- application/app/templates/userPanel.html | 26 +++++++++-------- static/css/login.css | 22 ++++++++++----- static/css/main.css | 11 ++++++-- static/profilepictures/default.svg | 28 +++++++++++++++++++ 7 files changed, 88 insertions(+), 35 deletions(-) create mode 100644 static/profilepictures/default.svg diff --git a/application/app/admin.py b/application/app/admin.py index 66b072a..7e81374 100644 --- a/application/app/admin.py +++ b/application/app/admin.py @@ -45,10 +45,13 @@ class CustomUserAdmin(UserAdmin): fieldsets_ = list((*UserAdmin.fieldsets,)) fieldsets_.insert(1, ( - "Balance", - {"fields": ("balance", "allow_order_with_negative_balance")}, - ) - ) + "Balance", + {"fields": ("balance", "allow_order_with_negative_balance")}, + )) + fieldsets_.insert(2, ( + "Profile Picture", + {"fields": ("profile_picture_filename",)}, + )) fieldsets = tuple(fieldsets_) list_display = ["username", "balance", "is_active", "allow_order_with_negative_balance"] diff --git a/application/app/models.py b/application/app/models.py index 7ce9370..370a0dd 100644 --- a/application/app/models.py +++ b/application/app/models.py @@ -20,6 +20,7 @@ class User(AbstractUser): balance = models.DecimalField(max_digits=8, decimal_places=2, default=0.00) allow_order_with_negative_balance = models.BooleanField(default=False) + profile_picture_filename = models.CharField(default="default.svg", max_length=25) def delete(self, *args, **kwargs): self.balance = 0 diff --git a/application/app/templates/registration/login.html b/application/app/templates/registration/login.html index 32b6ab0..af1f25c 100644 --- a/application/app/templates/registration/login.html +++ b/application/app/templates/registration/login.html @@ -2,6 +2,7 @@ {% extends "baseLayout.html" %} {% load i18n %} +{% load static %} {% block title %} {% translate "Drinks - Login" %} @@ -68,19 +69,20 @@