]> _ Git - cubeextranet.git/commitdiff
wip #3720 @1.5
authorvincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 22 Jun 2020 14:18:09 +0000 (14:18 +0000)
committervincent@cubedesigners.com <vincent@cubedesigners.com@f5622870-0f3c-0410-866d-9cb505b7a8ef>
Mon, 22 Jun 2020 14:18:09 +0000 (14:18 +0000)
inc/commons/DAO/class.common.dao.utilisateur.php
inc/commons/class.common.ajax.php
inc/commons/class.common.url.php
style/common.less

index 3c3086260aea746b6c6a98b6765a13d1834e1858..45d320fadaa302d3523ecb2eeba0da1934393220 100644 (file)
@@ -302,6 +302,7 @@ class commonDAOUtilisateur extends commonDAO
     {\r
         $c = $this->con->openCursor('extranet_users.user');\r
         $c->password = password_hash($nouveau, PASSWORD_BCRYPT);\r
+        $c->e1_resetpassword = '';\r
         return $c->update('WHERE id=\'' . $this->con->escape($utilisateur_id) . '\'');\r
     }\r
 \r
index d36e6490e273bcf6f3a258e2affa040089d2af27..d85ff5dcbcca9880a936dddb5ce393d08b2fc575 100644 (file)
@@ -75,12 +75,12 @@ class commonAjax
 
     public static function motdepasseOublie($args, &$x)
     {
-        self::form('recupMotdepasse', 'Mot de passe oublié ?', commonUrl::motdepasseOublie($args), __('Réinitialiser mon mot de passe'));
+        self::form('recupMotdepasse', __('Mot de passe oublié ?'), commonUrl::motdepasseOublie($args), __('Réinitialiser mon mot de passe'));
     }
 
     public static function mesParametres($args, &$x)
     {
-        self::form('sauveMesParametres', 'Mes paramètres', commonUrl::mesParametres($args), false);
+        self::form('sauveMesParametres', __('Mes paramètres'), commonUrl::mesParametres($args), false);
     }
 
     public static function sauveMesParametres($args, &$x)
@@ -93,7 +93,29 @@ class commonAjax
 
     public static function resetPassword($args, &$x)
     {
+        global $core;
+        $dao = new commonDAOUtilisateur($core->con);
+        $u = $dao->selectByEmail($_POST['email']);
+        if (!$u || !$u->reset_password || $u->reset_password != $_POST['reset_password']) {
+            $x->addContent('messagereset', __('Lien de réinitialisation invalide'));
+            return;
+        }
+        if (strlen($_POST['new_password']) < 8) {
+            $x->addContent('messagereset', __('Le mot de passe choisi doit comporter au moins 8 caractères'));
+            $x->addError('new_password');
+            $x->addError('confirm_password');
+            return;
+        }
+        if ($_POST['new_password'] != $_POST['confirm_password']) {
+            $x->addContent('messagereset', __('Le mot de passe et la confirmation ne correspondent pas'));
+            $x->addError('new_password');
+            $x->addError('confirm_password');
+            return;
+        }
 
+        $dao->changeMotdepasse($u->utilisateur_id, $_POST['new_password']);
+        $x->addAlert(__('Votre mot de passe a été réinitialisé.') . ' ' . __('Vous allez être redirigé vers la page de connexion'));
+        $x->addRedirection('/');
     }
 
     public static function recupMotdepasse($args, &$x)
index 11ec435538965b27e1551ff63501ada2a10153ca..297c8ad8bc1d0e7e66902d6c00d470d6f7194dc5 100644 (file)
@@ -87,11 +87,6 @@ class commonUrl
     public static function resetPassword($args)\r
     {\r
         global $core;\r
-        $dao = new commonDAOUtilisateur($core->con);\r
-        $u = $dao->selectByEmail($args[1]);\r
-        if (!$u || $u->reset_password != $args[2]) {\r
-            http::redirect('/');\r
-        }\r
 \r
         $res = commonPage::barre();\r
         $res .= commonPage::tMain();\r
@@ -101,8 +96,9 @@ class commonUrl
         $res .= '<table>';\r
         $res .= '<tr><th colspan="2"><strong>' . __('Réinitialisation de votre mot de passe') . '</strong></th></tr>';\r
         $res .= '<tr><td colspan="2">' . __('Veuillez choisir un mot de passe contenant au moins 8 caractères') . '</td></tr>';\r
-        $res .= '<tr><td>' . __('Votre nouveau mot de passe') . ' : </td><td>' . form::password('new_password', 20, 64, '') . '</td></tr>';\r
-        $res .= '<tr><td>' . __('Confirmation de votre nouveau mot de passe') . ' : </td><td>' . form::password('user_password', 20, 64, '') . '</td></tr>';\r
+        $res .= '<tr><td colspan="2"><div id="messagereset"></div></td></tr>';\r
+        $res .= '<tr><td>' . __('Votre nouveau mot de passe') . ' : </td><td>' . form::hidden('reset_password', $args[2]) . form::hidden('email', $args[1]) . form::password('new_password', 20, 64, '') . '</td></tr>';\r
+        $res .= '<tr><td>' . __('Confirmation de votre nouveau mot de passe') . ' : </td><td>' . form::password('confirm_password', 20, 64, '') . '</td></tr>';\r
         $res .= '<tr><td colspan="2" class="right"><a href="#" class="submit">' . $core->typo->BoutonOK('Réinitialiser le mot de passe') . '</a></td></tr>';\r
         $res .= '</table>';\r
         $res .= '</form>';\r
index e82a7b389eeb333b260caa8c26cb21d78eb268d2..2e117cef747a7d0e7019d4919c0d0c537f1a9eaf 100644 (file)
 input[type="text"], input[type="password"], input[type="email"], input[type="search"], textarea {
-       font-family: Verdana;
-       font-size: 12px;
-       -webkit-appearance: textfield;
-       outline: none;
+  font-family: Verdana;
+  font-size: 12px;
+  -webkit-appearance: textfield;
+  outline: none;
 }
 
 select {
-       font-family: Verdana;
-       font-size: 12px;
-       outline: none;
+  font-family: Verdana;
+  font-size: 12px;
+  outline: none;
 }
 
 h1 {
-       font-family: UniversCondensedBold;
-       font-weight: normal;
-       text-transform: uppercase;
-       font-size: 16px;
-       padding: 10px 0 5px;
+  font-family: UniversCondensedBold;
+  font-weight: normal;
+  text-transform: uppercase;
+  font-size: 16px;
+  padding: 10px 0 5px;
 }
 
 @font-face {
-       font-family: 'UniversCondensedBold';
-       src: url('univers-condensedbold-webfont.eot');
-       src: url('univers-condensedbold-webfont.eot?#iefix') format('embedded-opentype'),
-       url('univers-condensedbold-webfont.woff') format('woff'),
-       url('univers-condensedbold-webfont.ttf') format('truetype'),
-       url('univers-condensedbold-webfont.svg#UniversCondensedBold') format('svg');
-       font-weight: normal;
-       font-style: normal;
+  font-family: 'UniversCondensedBold';
+  src: url('univers-condensedbold-webfont.eot');
+  src: url('univers-condensedbold-webfont.eot?#iefix') format('embedded-opentype'),
+  url('univers-condensedbold-webfont.woff') format('woff'),
+  url('univers-condensedbold-webfont.ttf') format('truetype'),
+  url('univers-condensedbold-webfont.svg#UniversCondensedBold') format('svg');
+  font-weight: normal;
+  font-style: normal;
 }
 
 .b {
-       padding: 3px;
-       background: #ffffff;
-       border-radius: 7px;
-       -ms-box-shadow: 0px 0px 5px #999fab;
-       -o-box-shadow: 0px 0px 5px #999fab;
-       -moz-box-shadow: 0px 0px 5px #999fab;
-       -webkit-box-shadow: 0px 0px 5px #999fab;
-       box-shadow: 0px 0px 5px #999fab;
-       margin-bottom: 10px;
+  padding: 3px;
+  background: #ffffff;
+  border-radius: 7px;
+  -ms-box-shadow: 0px 0px 5px #999fab;
+  -o-box-shadow: 0px 0px 5px #999fab;
+  -moz-box-shadow: 0px 0px 5px #999fab;
+  -webkit-box-shadow: 0px 0px 5px #999fab;
+  box-shadow: 0px 0px 5px #999fab;
+  margin-bottom: 10px;
 }
 
 .b table {
-       width: 100%;
+  width: 100%;
 }
 
 /* Top left */
 .b table tr:first-child th:first-child {
-       border-radius: 6px 0 0 0;
+  border-radius: 6px 0 0 0;
 }
 
 .b table tr:first-child th:last-child {
-       border-radius: 0 6px 0 0;
+  border-radius: 0 6px 0 0;
 }
 
 .b table tr:last-child td:first-child {
-       border-radius: 0 0 0 6px;
+  border-radius: 0 0 0 6px;
 }
 
 .b table tr:last-child td:last-child {
-       border-radius: 0 0 6px 0;
+  border-radius: 0 0 6px 0;
 }
 
 .b table.legende tr td,
 .b table.legende tr th {
-       border-radius: 0 !important;
+  border-radius: 0 !important;
 }
 
 .b.login {
-       width: 450px;
-       margin: 0 auto;
+  width: 450px;
+  margin: 0 auto;
 }
 
 .b.resetpassword {
-       width: 600px;
-       margin: 0 auto;
+  width: 600px;
+  margin: 0 auto;
+
+  #messagereset {
+    color: #c00;
+    font-weight: bold;
+    text-align: center;
+  }
 }
 
 
 .onglet {
-       background: url('onglet.png');
-       background-position: top left;
-       background-repeat: repeat-x;
-       text-align: center;
-       border-radius: 7px 7px 0 0;
-       color: #ffffff;
-       font-size: 14px;
-       width: 119px;
-       text-transform: uppercase;
-       font-family: UniversCondensedBold, Arial, Helvetica, sans-serif;
-       display: inline-block;
-       height: 24px;
-       margin-right: 1px;
-       text-decoration: none;
-       padding: 7px 0 0 0;
-       font-weight: normal;
+  background: url('onglet.png');
+  background-position: top left;
+  background-repeat: repeat-x;
+  text-align: center;
+  border-radius: 7px 7px 0 0;
+  color: #ffffff;
+  font-size: 14px;
+  width: 119px;
+  text-transform: uppercase;
+  font-family: UniversCondensedBold, Arial, Helvetica, sans-serif;
+  display: inline-block;
+  height: 24px;
+  margin-right: 1px;
+  text-decoration: none;
+  padding: 7px 0 0 0;
+  font-weight: normal;
 }
 
 .onglet.active, .onglet:hover {
-       background-position: bottom left;
+  background-position: bottom left;
 
 }
 
 #ajaxLoader {
-       position: fixed;
-       display: none;
-       top: 0px;
-       left: 0px;
-       width: 100%;
-       height: 100%;
-       z-index: 10000000;
+  position: fixed;
+  display: none;
+  top: 0px;
+  left: 0px;
+  width: 100%;
+  height: 100%;
+  z-index: 10000000;
 }
 
 #ajaxLoader .c {
-       background: #fff;
-       font-size: 16px;
-       padding: 20px;
-       width: 300px;
-       height: 50px;
-       margin: 0 auto;
-       border-radius: 0 0 10px 10px;
-       box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
-       -moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
-       -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
-       -ms-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
-       -o-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
+  background: #fff;
+  font-size: 16px;
+  padding: 20px;
+  width: 300px;
+  height: 50px;
+  margin: 0 auto;
+  border-radius: 0 0 10px 10px;
+  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
+  -moz-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
+  -webkit-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
+  -ms-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
+  -o-box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.5);
 }
 
 #ajaxLoader .c img {
-       vertical-align: middle;
-       display: block;
-       float: left;
+  vertical-align: middle;
+  display: block;
+  float: left;
 }
 
 #ajaxLoader .c p {
-       width: 240px;
-       float: left;
-       margin-left: 20px;
-       text-align: center;
+  width: 240px;
+  float: left;
+  margin-left: 20px;
+  text-align: center;
 }
 
 form#upload {
-       width: 600px;
-       margin: 0 auto;
-       padding: 0 0 20px;
-       input[type="file"] {
-               position: absolute;
-               top: 0;
-               left: 0;
-               opacity: 0;
-               width: 1px;
-               height: 1px;
-       }
-
-       a.button {
-               height: 30px;
-               box-sizing: border-box;
-               color: #fff;
-               font-weight: 700;
-               background-color: #9cc10e;
-               display: inline-block;
-               padding: 7px 10px;
-               text-decoration: none;
-               border-radius: 5px;
-               text-align: center;
-               width: 120px;
-               vertical-align: top;
-       }
-
-       .progress {
-               border: 1px solid #ccc;
-               border-radius: 5px;
-
-               width: 430px;
-               height: 30px;
-               margin-right: 10px;
-               display: inline-block;
-               vertical-align: top;
-               position: relative;
-
-               .back {
-                       position: absolute;
-                       background-color: #fff;
-                       width: 100%;
-                       height: 30px;
-                       top: 0;
-                       left: 0;
-                       z-index: 1;
-               }
-
-               .bar {
-                       position: absolute;
-                       background-color: #1F222A;
-                       width: 0%;
-                       height: 30px;
-                       top: 0;
-                       left: 0;
-                       z-index: 2;
-               }
-
-               .status {
-                       position: absolute;
-                       width: 100%;
-                       text-align: center;
-                       color: #9cc10e;
-                       top: 7px;
-                       z-index: 3;
-               }
-       }
+  width: 600px;
+  margin: 0 auto;
+  padding: 0 0 20px;
+
+  input[type="file"] {
+    position: absolute;
+    top: 0;
+    left: 0;
+    opacity: 0;
+    width: 1px;
+    height: 1px;
+  }
+
+  a.button {
+    height: 30px;
+    box-sizing: border-box;
+    color: #fff;
+    font-weight: 700;
+    background-color: #9cc10e;
+    display: inline-block;
+    padding: 7px 10px;
+    text-decoration: none;
+    border-radius: 5px;
+    text-align: center;
+    width: 120px;
+    vertical-align: top;
+  }
+
+  .progress {
+    border: 1px solid #ccc;
+    border-radius: 5px;
+
+    width: 430px;
+    height: 30px;
+    margin-right: 10px;
+    display: inline-block;
+    vertical-align: top;
+    position: relative;
+
+    .back {
+      position: absolute;
+      background-color: #fff;
+      width: 100%;
+      height: 30px;
+      top: 0;
+      left: 0;
+      z-index: 1;
+    }
+
+    .bar {
+      position: absolute;
+      background-color: #1F222A;
+      width: 0%;
+      height: 30px;
+      top: 0;
+      left: 0;
+      z-index: 2;
+    }
+
+    .status {
+      position: absolute;
+      width: 100%;
+      text-align: center;
+      color: #9cc10e;
+      top: 7px;
+      z-index: 3;
+    }
+  }
 }
\ No newline at end of file