From d8e2bcfff0ffa799fd3369f840a65cf6b41d5514 Mon Sep 17 00:00:00 2001 From: "vincent@cubedesigners.com" Date: Mon, 22 Jun 2020 14:18:09 +0000 Subject: [PATCH] wip #3720 @1.5 --- .../DAO/class.common.dao.utilisateur.php | 1 + inc/commons/class.common.ajax.php | 26 +- inc/commons/class.common.url.php | 10 +- style/common.less | 305 +++++++++--------- 4 files changed, 184 insertions(+), 158 deletions(-) diff --git a/inc/commons/DAO/class.common.dao.utilisateur.php b/inc/commons/DAO/class.common.dao.utilisateur.php index 3c3086260..45d320fad 100644 --- a/inc/commons/DAO/class.common.dao.utilisateur.php +++ b/inc/commons/DAO/class.common.dao.utilisateur.php @@ -302,6 +302,7 @@ class commonDAOUtilisateur extends commonDAO { $c = $this->con->openCursor('extranet_users.user'); $c->password = password_hash($nouveau, PASSWORD_BCRYPT); + $c->e1_resetpassword = ''; return $c->update('WHERE id=\'' . $this->con->escape($utilisateur_id) . '\''); } diff --git a/inc/commons/class.common.ajax.php b/inc/commons/class.common.ajax.php index d36e6490e..d85ff5dcb 100644 --- a/inc/commons/class.common.ajax.php +++ b/inc/commons/class.common.ajax.php @@ -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) diff --git a/inc/commons/class.common.url.php b/inc/commons/class.common.url.php index 11ec43553..297c8ad8b 100644 --- a/inc/commons/class.common.url.php +++ b/inc/commons/class.common.url.php @@ -87,11 +87,6 @@ class commonUrl public static function resetPassword($args) { global $core; - $dao = new commonDAOUtilisateur($core->con); - $u = $dao->selectByEmail($args[1]); - if (!$u || $u->reset_password != $args[2]) { - http::redirect('/'); - } $res = commonPage::barre(); $res .= commonPage::tMain(); @@ -101,8 +96,9 @@ class commonUrl $res .= ''; $res .= ''; $res .= ''; - $res .= ''; - $res .= ''; + $res .= ''; + $res .= ''; + $res .= ''; $res .= ''; $res .= '
' . __('Réinitialisation de votre mot de passe') . '
' . __('Veuillez choisir un mot de passe contenant au moins 8 caractères') . '
' . __('Votre nouveau mot de passe') . ' : ' . form::password('new_password', 20, 64, '') . '
' . __('Confirmation de votre nouveau mot de passe') . ' : ' . form::password('user_password', 20, 64, '') . '
' . __('Votre nouveau mot de passe') . ' : ' . form::hidden('reset_password', $args[2]) . form::hidden('email', $args[1]) . form::password('new_password', 20, 64, '') . '
' . __('Confirmation de votre nouveau mot de passe') . ' : ' . form::password('confirm_password', 20, 64, '') . '
' . $core->typo->BoutonOK('Réinitialiser le mot de passe') . '
'; $res .= ''; diff --git a/style/common.less b/style/common.less index e82a7b389..2e117cef7 100644 --- a/style/common.less +++ b/style/common.less @@ -1,212 +1,219 @@ 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 -- 2.39.5