From 4be39876eb7a3b1bb4421177bf3e402d01899bb5 Mon Sep 17 00:00:00 2001 From: Stephen Early Date: Wed, 17 Jan 2024 11:07:42 +0000 Subject: [PATCH] Button and page for adding new users in the web interface --- .../tillweb/templates/tillweb/grouplist.html | 8 ++-- .../tillweb/templates/tillweb/new-user.html | 19 ++++++++++ .../tillweb/templates/tillweb/userlist.html | 5 +++ quicktill/tillweb/urls.py | 1 + quicktill/tillweb/views.py | 38 ++++++++++++++++++- 5 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 quicktill/tillweb/templates/tillweb/new-user.html diff --git a/quicktill/tillweb/templates/tillweb/grouplist.html b/quicktill/tillweb/templates/tillweb/grouplist.html index 82b80f25..04f44d58 100644 --- a/quicktill/tillweb/templates/tillweb/grouplist.html +++ b/quicktill/tillweb/templates/tillweb/grouplist.html @@ -4,6 +4,10 @@ {% block tillcontent %} +{% if may_create_group %} +Add new group +{% endif %} + {% if groups %} @@ -31,8 +35,4 @@

No groups have been defined.

{% endif %} -{% if may_create_group %} -Add new group -{% endif %} - {% endblock %} diff --git a/quicktill/tillweb/templates/tillweb/new-user.html b/quicktill/tillweb/templates/tillweb/new-user.html new file mode 100644 index 00000000..3bd99110 --- /dev/null +++ b/quicktill/tillweb/templates/tillweb/new-user.html @@ -0,0 +1,19 @@ +{% extends "tillweb/tillweb.html" %} +{% load static %} + +{% block title %}{{till}} — create new user{% endblock %} + +{% block tillcontent %} + +
+ Till user accounts can be disabled, which means they won't appear in the normal list of users. Before adding a new user to the till, please check that they don't already have an account. +
+ +{% csrf_token %} + {% include "form-horizontal.html" %} + + + +{% endblock %} diff --git a/quicktill/tillweb/templates/tillweb/userlist.html b/quicktill/tillweb/templates/tillweb/userlist.html index d20fdabc..ab25f14e 100644 --- a/quicktill/tillweb/templates/tillweb/userlist.html +++ b/quicktill/tillweb/templates/tillweb/userlist.html @@ -15,6 +15,10 @@
runtill adduser root root builtin:alice
+{% if may_create_user %} +Add new user +{% endif %} +