aboutsummaryrefslogtreecommitdiffstats
path: root/accounts
diff options
context:
space:
mode:
authorAndrea Lepori <alepori@student.ethz.ch>2022-03-23 19:24:09 +0100
committerAndrea Lepori <alepori@student.ethz.ch>2022-03-23 19:24:21 +0100
commit7dfc0383561cb9f13282e7779b919f5b17859f86 (patch)
treed2f3ed554dfd259025845c7f93e02254e1a8beb3 /accounts
parentinitial support of user switcher (diff)
parentin case of error redirect to home page (diff)
downloadscout-subs-7dfc0383561cb9f13282e7779b919f5b17859f86.tar.gz
scout-subs-7dfc0383561cb9f13282e7779b919f5b17859f86.zip
Merge branch 'master' into dev
Diffstat (limited to 'accounts')
-rw-r--r--accounts/templates/accounts/index.html15
-rw-r--r--accounts/templates/accounts/terms.html6
-rw-r--r--accounts/views.py18
3 files changed, 33 insertions, 6 deletions
diff --git a/accounts/templates/accounts/index.html b/accounts/templates/accounts/index.html
index 2a21cbe..563de89 100644
--- a/accounts/templates/accounts/index.html
+++ b/accounts/templates/accounts/index.html
@@ -17,7 +17,14 @@
{% endblock%}
{% block content %}
-<form action="{% url 'personal'%}" method="post" id="form1" enctype="multipart/form-data">
+<div class="tap-target {{color}}" data-target="home_btn">
+ <div class="tap-target-content">
+ <h5 style="color:white">Continua l'attivazione</h5>
+ <p style="color:white">Usa questo pulsante per tornare alla home e continuare il processo d'attivazione</p>
+ </div>
+</div>
+
+<form action="{% url 'personal'%}?saved=true" method="post" id="form1" enctype="multipart/form-data">
<div id="personal" class="row">
<div class="col l8 offset-l2 s12">
<div class="card-panel">
@@ -54,7 +61,7 @@
<option value="posto" {{branca_pionieri}}>Pionieri</option>
<option value="clan" {{branca_rover}}>Rover</option>
</select>
- <label>Branca</label>
+ <label>Branca (campo non modificabile)</label>
</div>
<div class="input-field col l4 s12">
<input value="{{parent_name}}" name="parent_name" id="parent_name" type="text" {{validation_dic.parent_name|safe}}>
@@ -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/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 @@
<div class="card">
<div class="card-content">
<h5>Termini e condizioni</h5>
+ <h6>Trattamento dei dati</h6>
<blockquote>
- Creando un account accetti e comprendi i seguenti termini: <br>
- 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.
</blockquote>
</div>
</div>
diff --git a/accounts/views.py b/accounts/views.py
index e9d2bfe..9f7c9b3 100644
--- a/accounts/views.py
+++ b/accounts/views.py
@@ -29,6 +29,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"]
@@ -578,7 +585,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.get_full_path())
else:
# no post, create empty validation
@@ -636,10 +643,16 @@ 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
+ 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,
@@ -693,6 +706,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)