Browse Source

continuo con le modifiche sul cambio password

mauro 1 month ago
parent
commit
076b195919
3 changed files with 31 additions and 22 deletions
  1. 0 2
      utente/forms.py
  2. 26 10
      utente/templates/utente.edit.password.login.html
  3. 5 10
      utente/views.py

+ 0 - 2
utente/forms.py

@@ -47,7 +47,6 @@ class formUpdatePasswordPrimoLogin(forms.Form):
     if self.data['pin1'] != self.data['pin2']:
       # password non corrispondente
       raise forms.ValidationError("Le due password devono essere uguali")
-    if self.data['pin1'] == self.data['cfisc']:
       # nome uguale a login
       raise forms.ValidationError("La password non puo' essere uguale al login")
     if len(self.data['pin1']) < int(getConfig('PasswordMin')):
@@ -58,7 +57,6 @@ class formUpdatePasswordPrimoLogin(forms.Form):
 class formUpdatePasswordLogin(forms.Form):
   def __init__(self,*args,**kwargs):
     forms.Form.__init__(self,*args,**kwargs)
-    self.fields['cfisc'] = forms.CharField(required=True)
     self.fields['uuid'] = forms.CharField(required=True)
     self.fields['pin1'] = forms.CharField(required=True)
     self.fields['pin2'] = forms.CharField(required=True)

+ 26 - 10
utente/templates/utente.edit.password.login.html

@@ -1,6 +1,7 @@
 {% extends 'base.html' %}
 
 {% block top %}
+    <!--
     <div class='form-outline mb-3 text-center btn-primary h3'>
            {{ HeaderTitle }}
     </div>
@@ -9,20 +10,34 @@
     </div>
     <div class='form-outline mb-3 text-center btn-primary h3'>
            Amministratore: {{ admin.username }}
-    </div>
+    </div> -->
 {% endblock %}
 
-{% block body %}
+{% block body-login %}
+<div class="form-container card p-3 bg-light">
+  <div style='padding-top:50px;padding-bottom:20px;background-color:#a1cb0f;'>
+    <p class="h1 text-center">CCS Health</p>
+    <p class="h3 text-center">Corporate Care Solution</p>
+  </div>
+
+  <div>
+    <br/>
+  </div>
+
+  <div class="container text-center">
+    <p class="lead">Per accedere utilizzare il proprio codice fiscale o il proprio login name insieme al Pin o alla Password assegnata.</p>
+  </div>
+
+  <div>
+          <hr>
+  </div>
 
   <!-- profilo utente -->
   <div>
     <form name='UpdatePassword' method='post' class='form-container card p-3 bg-light'>
       {% csrf_token %}
-      <div class='form-outline mb-3 {% if "cfisc" in informazione.errors %} text-danger {% endif %}'>
-      <label class='form-label' for='cfisc'>Email - Codice Fiscale - Login</label>
-      <input type='text'  class='form-control' id='cfisc' name='cfisc' value="{{ informazione.cfisc.value }}"
-    </div>
     <div class='form-outline mb-3'>
+	    <input type='hidden' class='form-control' id='cfisc' name='cfisc' value="{{ informazione.cfisc.value }}" readonly>
       <input type='hidden'  class='form-control' id='uuid' name='uuid' value="{{ informazione.uuid.value }}" readonly>
     <div>
     <div class='form-outline mb-3 {% if "pin1" in informazione.errors %} text-danger {% endif %}'>
@@ -43,9 +58,10 @@
   {% endblock %}
 
   {% block bottom %}
+<!-- errori
+
   <div>
-  <!-- errori
-  <div class='form-container card p-3 bg-light'>
+    <div class='form-container card p-3 bg-light'>
   {% if informazione.errors %}
     {{ informazione.errors }}
     <br>--</br>
@@ -53,6 +69,6 @@
   {% endif %}
   {% if informazione.errors.pin1 %}<p class="alarm">alarme</p>{% endif %}
   </div>
-  fine zona errori -->
-  <div>
+  fine zona errori
+  <div> -->
   {% endblock %}

+ 5 - 10
utente/views.py

@@ -612,20 +612,15 @@ def updatePasswordFromLogin(request,uuid):
       d = None
       # 1 tentativo su codice fiscale
       try: 
-        a = Utente.objects.get(codicefiscale=cfisc.upper())
+        a = Utente.objects.get(uuid=uuidl)
         d = 'u'
       except Utente.DoesNotExist as dne:
         print('informazione non trovata tra i codici fiscali utente')
         try:
-          a = Utente.objects.get(mail=cfisc.lower())
-          d = 'u'
-        except Utente.DoesNotExist as dne:
-          print('informazione non trovata tra le email')
-          try:
-            a = Amministratore.objects.get(login=cfisc.lower())
-            d = 'a'
-          except Amministratore.DoesNotExist as dne:
-            print('informazione non trovata tra i login amministratotore')
+          a = Amministratore.objects.get(uuid=uuidl)
+          d = 'a'
+        except Amministratore.DoesNotExist as dne:
+          print('informazione non trovata tra i login amministratotore')
 
       print('record',a.id,a.nome,a.uuid,d)