From c98e4ae15237d9394e3610d5d60d7f2cbc03ef9c Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Mon, 10 Jan 2022 18:50:07 +0100 Subject: add authlib to requirements --- requirements.txt | 1 + version.txt | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e442da7..62c7159 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,3 +6,4 @@ pytz pdf2image django-debug-toolbar requests +authlib diff --git a/version.txt b/version.txt index 56eed72..4df8563 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.4 -rev=22 +rev=23 -- cgit v1.2.1 From d20c71fd3bea17ab88f45985196e266668620615 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:01:43 +0100 Subject: increase max char count for additional fields --- client/models.py | 10 +++++----- version.txt | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/models.py b/client/models.py index cd3cf88..e01fe1f 100644 --- a/client/models.py +++ b/client/models.py @@ -15,7 +15,7 @@ class DocumentType(models.Model): medical_data = models.BooleanField(default=False) custom_data = models.BooleanField(default=False) custom_message = models.BooleanField(default=False) - custom_message_text = models.CharField(default="", max_length=250) + custom_message_text = models.CharField(default="", max_length=2048) staff_only = models.BooleanField(default=False) max_instances = models.IntegerField(default=0) name = models.CharField(default="", max_length=250) @@ -88,15 +88,15 @@ class Document(models.Model): class KeyVal(models.Model): container = models.ForeignKey( Document, db_index=True, on_delete=models.CASCADE) - key = models.CharField(max_length=240, db_index=True) - value = models.CharField(max_length=240, db_index=True) + key = models.CharField(max_length=2048, db_index=True) + value = models.CharField(max_length=2048, db_index=True) class Keys(models.Model): container = models.ForeignKey( DocumentType, db_index=True, on_delete=models.CASCADE) - key = models.CharField(max_length=240, db_index=True) - key_extra = models.CharField(max_length=1024, default="") + key = models.CharField(max_length=2048, db_index=True) + key_extra = models.CharField(max_length=2048, default="") class UserCode(models.Model): diff --git a/version.txt b/version.txt index 4df8563..d03e912 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.4 -rev=23 +rev=24 -- cgit v1.2.1 From 76ce07ad01474f8da04a877a6e6f0895a5829c89 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:03:32 +0100 Subject: create db migrations --- client/migrations/0014_auto_20220111_1503.py | 38 ++++++++++++++++++++++++++++ version.txt | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 client/migrations/0014_auto_20220111_1503.py diff --git a/client/migrations/0014_auto_20220111_1503.py b/client/migrations/0014_auto_20220111_1503.py new file mode 100644 index 0000000..99c7c18 --- /dev/null +++ b/client/migrations/0014_auto_20220111_1503.py @@ -0,0 +1,38 @@ +# Generated by Django 3.1.4 on 2022-01-11 14:03 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('client', '0013_keys_key_extra'), + ] + + operations = [ + migrations.AlterField( + model_name='documenttype', + name='custom_message_text', + field=models.CharField(default='', max_length=2048), + ), + migrations.AlterField( + model_name='keys', + name='key', + field=models.CharField(db_index=True, max_length=2048), + ), + migrations.AlterField( + model_name='keys', + name='key_extra', + field=models.CharField(default='', max_length=2048), + ), + migrations.AlterField( + model_name='keyval', + name='key', + field=models.CharField(db_index=True, max_length=2048), + ), + migrations.AlterField( + model_name='keyval', + name='value', + field=models.CharField(db_index=True, max_length=2048), + ), + ] diff --git a/version.txt b/version.txt index d03e912..02b14dc 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.4 -rev=24 +rev=25 -- cgit v1.2.1 From 77dfb2dd619863cf2a18893aa5f3de03b7eaa006 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:21:12 +0100 Subject: correct linebreaks written in python --- client/templates/client/approve_doc_pdf.html | 2 +- client/templates/client/doc_create.html | 6 +++--- client/templates/client/doc_edit.html | 2 +- client/templates/client/index.html | 2 +- server/templates/server/doc_type.html | 2 +- version.txt | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/client/templates/client/approve_doc_pdf.html b/client/templates/client/approve_doc_pdf.html index 3ed4d86..ae993f0 100644 --- a/client/templates/client/approve_doc_pdf.html +++ b/client/templates/client/approve_doc_pdf.html @@ -29,7 +29,7 @@

Inoltre accetto e prendo nota della seguente clausula aggiuntiva:
- {{doc.document_type.custom_message_text}} + {{doc.document_type.custom_message_text | linebreaksbr}} {% endif %}

diff --git a/client/templates/client/doc_create.html b/client/templates/client/doc_create.html index ce5f39d..c1db432 100644 --- a/client/templates/client/doc_create.html +++ b/client/templates/client/doc_create.html @@ -98,9 +98,9 @@
-
-

- {{custom_message_text}} +

+

+ {{custom_message_text | linebreaksbr}}

diff --git a/client/templates/client/doc_edit.html b/client/templates/client/doc_edit.html index a9cc056..3af3584 100644 --- a/client/templates/client/doc_edit.html +++ b/client/templates/client/doc_edit.html @@ -56,7 +56,7 @@

- {{custom_message_text}} + {{custom_message_text | linebreaksbr}}

diff --git a/client/templates/client/index.html b/client/templates/client/index.html index e31ce34..1885dd1 100644 --- a/client/templates/client/index.html +++ b/client/templates/client/index.html @@ -76,7 +76,7 @@

Inoltre accetto e prendo nota della seguente clausula aggiuntiva:
- {{doc.document_type.custom_message_text}} + {{doc.document_type.custom_message_text | linebreaksbr}} {% endif %}

diff --git a/server/templates/server/doc_type.html b/server/templates/server/doc_type.html index 8b2131d..4f8fe6f 100644 --- a/server/templates/server/doc_type.html +++ b/server/templates/server/doc_type.html @@ -213,7 +213,7 @@ messageMessaggio aggiuntivo
- {{doctype.custom_message_text}} + {{doctype.custom_message_text | linebreaksbr}}
{% endif %} diff --git a/version.txt b/version.txt index 02b14dc..a897277 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.4 -rev=25 +rev=26 -- cgit v1.2.1 From 1f17a13b6f8069d04fc4d172e5a891fc3e7a7c7d Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:52:19 +0100 Subject: remove linebrakes on approve doc pdf --- client/templates/client/approve_doc_pdf.html | 3 --- version.txt | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/client/templates/client/approve_doc_pdf.html b/client/templates/client/approve_doc_pdf.html index ae993f0..db1478e 100644 --- a/client/templates/client/approve_doc_pdf.html +++ b/client/templates/client/approve_doc_pdf.html @@ -35,9 +35,6 @@




-



-



-



diff --git a/version.txt b/version.txt index a897277..df9103d 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.4 -rev=26 +rev=27 -- cgit v1.2.1 From 99915b9316036ac8ae13fe8d692080b460c0ad55 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 15:57:39 +0100 Subject: fix user filter not displaing properly --- server/templates/server/doc_list.html | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/server/templates/server/doc_list.html b/server/templates/server/doc_list.html index 736fdd4..5b898ec 100644 --- a/server/templates/server/doc_list.html +++ b/server/templates/server/doc_list.html @@ -508,7 +508,7 @@ $('#chips_owner').chips({ autocompleteOptions: { data: { {% for user in users %} - '{{user.username}} ({{user.first_name}} {{user.last_name}})': null, + '{{user.user__username}} ({{user.user__first_name}} {{user.user__last_name}})': null, {% endfor %} }, limit: Infinity, diff --git a/version.txt b/version.txt index df9103d..b58ad09 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.4 -rev=27 +rev=28 -- cgit v1.2.1 From 9f1ae7f9b3fab995748ead2549b77d4d0605521f Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 11 Jan 2022 16:01:54 +0100 Subject: hide user from data request if not approved --- server/views.py | 6 ++++-- version.txt | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/server/views.py b/server/views.py index 0e032f0..c91db1e 100644 --- a/server/views.py +++ b/server/views.py @@ -1472,11 +1472,13 @@ def data_request(request): if "request" not in request.POST.keys(): context["error"] = "Selezionare una richesta" elif request.POST["request"] == "email_all": - users_email = User.objects.filter(groups__name=parent_group).values_list("email", flat=True) + perm = Permission.objects.get(codename="approved") + users_email = User.objects.filter(groups__name=parent_group, user_permissions=perm).values_list("email", flat=True) data = ", ".join(users_email) context["data"] = data elif request.POST["request"] == "email_non_staff": - users_email = User.objects.filter(groups__name=parent_group).exclude(groups__name="capi").values_list("email", flat=True) + perm = Permission.objects.get(codename="approved") + users_email = User.objects.filter(groups__name=parent_group, user_permission=perm).exclude(groups__name="capi").values_list("email", flat=True) data = ", ".join(users_email) context["data"] = data elif request.POST["request"] == "data_user": diff --git a/version.txt b/version.txt index b58ad09..38b0958 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.4 -rev=28 +rev=29 -- cgit v1.2.1 From f6f9daa8100fa59421692e2afbbc44f4d5753d66 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Fri, 21 Jan 2022 17:58:27 +0100 Subject: edit terms + change log for new version --- CHANGELOG.md | 8 ++++++++ accounts/templates/accounts/terms.html | 6 ++++-- templates/registration/base_client.html | 4 +++- version.txt | 4 ++-- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eae250a..4a59998 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# 0.5 (21 jan 2022) +- Bug: users of other groups also visible in user list +- Show warning if some account fields are empty +- Implementation of oauth login using midata/hitobito +- New settings tab in profile page +- Password change +- Multiple choice for custom parameters + # 0.4 (23 set 2021) - Bug: emergency document list visible also to non "capi" - Overall performance improvements leveraging SQL queries diff --git a/accounts/templates/accounts/terms.html b/accounts/templates/accounts/terms.html index 8b4443b..e7de26b 100644 --- a/accounts/templates/accounts/terms.html +++ b/accounts/templates/accounts/terms.html @@ -12,9 +12,11 @@
Termini e condizioni
+
Trattamento dei dati
- Creando un account accetti e comprendi i seguenti termini:
- Tutti i dati inseriti all'interno del sistema verranno condivisi con la persona a capo del gruppo di cui fai parte. + Tutti i dati inseriti verranno trattati in maniera confidenziale + e condivisi con i responsabili della sezione scout. I quali + li useranno per scopi organizzativi e non li condivideranno con terze parti.
diff --git a/templates/registration/base_client.html b/templates/registration/base_client.html index 362238c..1827f4a 100644 --- a/templates/registration/base_client.html +++ b/templates/registration/base_client.html @@ -117,7 +117,9 @@
  • list
  • {% endif %}
  • info_outline
  • -
  • exit_to_app
  • + {% if user.is_authenticated %} +
  • exit_to_app
  • + {% endif %}
    {% block toolbar %} diff --git a/version.txt b/version.txt index 38b0958..7710394 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ -version=0.4 -rev=29 +version=0.5 +rev=1 -- cgit v1.2.1 From 901bd6cb3b14fc5aa9e2f445ad5f4a81a29b9424 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 25 Jan 2022 10:47:45 +0100 Subject: suppress deprecation warning --- accounts/views.py | 7 +++++++ version.txt | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/accounts/views.py b/accounts/views.py index cd17552..cef575d 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -27,6 +27,13 @@ from pdf2image.exceptions import ( PDFSyntaxError ) +# suppress warning about dateparser deprecated dependencies +import warnings +warnings.filterwarnings( + "ignore", + message="The localize method is no longer necessary, as this time zone supports the fold attribute", +) + oauth = OAuth() hitobito = oauth.register(name="hitobito") api_url = settings.AUTHLIB_OAUTH_CLIENTS["hitobito"]["api_url"] diff --git a/version.txt b/version.txt index 7710394..9a16e5f 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.5 -rev=1 +rev=2 -- cgit v1.2.1 From 89e2b918826d1cd09240a054b118dd2db5e49086 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 25 Jan 2022 10:48:53 +0100 Subject: explicit comment on non editable fields --- accounts/templates/accounts/index.html | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/templates/accounts/index.html b/accounts/templates/accounts/index.html index 2a21cbe..670c490 100644 --- a/accounts/templates/accounts/index.html +++ b/accounts/templates/accounts/index.html @@ -54,7 +54,7 @@ - +
    diff --git a/version.txt b/version.txt index 9a16e5f..8b48a99 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.5 -rev=2 +rev=3 -- cgit v1.2.1 From 122bf81d854c380ea1f9a15d34a955722cca3e0c Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Tue, 25 Jan 2022 10:55:39 +0100 Subject: fix chrome showing white page on production --- accounts/views.py | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/views.py b/accounts/views.py index cef575d..dad6075 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -510,7 +510,7 @@ def personal_wrapper(request, errors): # if there wasn't any error redirect to clear POST if len(errors) == 0: - return HttpResponseRedirect("") + return HttpResponseRedirect(request.path_info) else: # no post, create empty validation diff --git a/version.txt b/version.txt index 8b48a99..251105c 100644 --- a/version.txt +++ b/version.txt @@ -1,2 +1,2 @@ version=0.5 -rev=3 +rev=4 -- cgit v1.2.1 From 7b3ff4bacab76138a45f018fcfee055c8fd1f186 Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Mon, 31 Jan 2022 17:10:39 +0100 Subject: add go home message after saving data and other warning --- accounts/templates/accounts/index.html | 13 ++++++++++++- accounts/views.py | 12 ++++++++++-- client/templates/client/doc_create.html | 12 ++++++++++++ client/templates/client/doc_edit.html | 12 ++++++++++++ templates/registration/base_client.html | 9 ++++++--- version.txt | 2 +- 6 files changed, 53 insertions(+), 7 deletions(-) diff --git a/accounts/templates/accounts/index.html b/accounts/templates/accounts/index.html index 670c490..563de89 100644 --- a/accounts/templates/accounts/index.html +++ b/accounts/templates/accounts/index.html @@ -17,7 +17,14 @@ {% endblock%} {% block content %} -
    +
    +
    +
    Continua l'attivazione
    +

    Usa questo pulsante per tornare alla home e continuare il processo d'attivazione

    +
    +
    + +
    @@ -456,12 +463,16 @@ $(document).ready(function() { $('.datepicker').datepicker(options); $('.tabs').tabs(); $('select').formSelect(); + $('.tap-target').tapTarget(); {% for error in errors %} M.toast({html: '{{ error }}', classes: 'orange'}) {% endfor %} {% if ok_message %} M.toast({html: '{{ ok_message }}', classes: 'green'}) {% endif %} + {% if home_tooltip %} + $('.tap-target').tapTarget('open'); + {% endif %} document.getElementById("vac_certificate").onchange = function() { for (i=0; i < this.files.length; i++) { if(this.files[i].size > 1048576*10) { diff --git a/accounts/views.py b/accounts/views.py index dad6075..a2381af 100644 --- a/accounts/views.py +++ b/accounts/views.py @@ -510,7 +510,7 @@ def personal_wrapper(request, errors): # if there wasn't any error redirect to clear POST if len(errors) == 0: - return HttpResponseRedirect(request.path_info) + return HttpResponseRedirect(request.get_full_path()) else: # no post, create empty validation @@ -568,10 +568,17 @@ def personal_wrapper(request, errors): if midata_user: midata_disable = " readonly disabled" if not copy_from_midata(request, usercode): - return HttpResponseRedirect(request.path_info) + return HttpResponseRedirect(request.get_full_path()) usable_password = request.user.has_usable_password() + # check if user has saved the form + home_tooltip = False + print(errors) + if "saved" in request.GET: + # show tooltip only if user is not approved and there are no errors + home_tooltip = (not request.user.has_perm("client.approved")) and (len(errors) == 0) + # fill context context = { 'validation_dic': validation_dic, @@ -625,6 +632,7 @@ def personal_wrapper(request, errors): 'settings_active': settings_active, 'personal_active': personal_active, 'midata_enabled': MIDATA_ENABLED, + 'home_tooltip': home_tooltip, } return render(request, 'accounts/index.html', context) diff --git a/client/templates/client/doc_create.html b/client/templates/client/doc_create.html index c1db432..71bdbbe 100644 --- a/client/templates/client/doc_create.html +++ b/client/templates/client/doc_create.html @@ -133,6 +133,18 @@ {% endif %} {% endfor %} {% endif %} +
    +
    +
    +
    +

    + Attenzione: il documento non sarĂ  valido fino a quando non viene approvato. Selezionare + il documento dalla pagina principale per approvarlo. +

    +
    +
    +
    +

    diff --git a/client/templates/client/doc_edit.html b/client/templates/client/doc_edit.html index 3af3584..40deb26 100644 --- a/client/templates/client/doc_edit.html +++ b/client/templates/client/doc_edit.html @@ -96,6 +96,18 @@ {% endif %} {% endfor %} {% endif %} +
    +
    +
    +
    +

    + Attenzione: il documento non sarĂ  valido fino a quando non viene approvato. Selezionare + il documento dalla pagina principale per approvarlo. +

    +
    +
    +
    +

    diff --git a/templates/registration/base_client.html b/templates/registration/base_client.html index 1827f4a..21f3dcf 100644 --- a/templates/registration/base_client.html +++ b/templates/registration/base_client.html @@ -87,6 +87,10 @@ border-bottom: none; box-shadow: 0 1px 0 0 #9e9e9e; } + + .breadcrumb:last-child { + color: {{hexcolor}} + } @@ -95,9 +99,8 @@