NEW add doAction hook in passwordforgotten page

This commit is contained in:
Regis Houssin 2020-12-11 13:31:50 +01:00
parent eedaca1476
commit 4d0ce326c4

View File

@ -64,9 +64,16 @@ if (GETPOST('dol_use_jmobile', 'alpha') || !empty($_SESSION['dol_use_jmobile']))
* Actions * Actions
*/ */
// Validate new password $parameters = array('username' => $username);
if ($action == 'validatenewpassword' && $username && $passwordhash) $reshook = $hookmanager->executeHooks('doActions', $parameters, $object, $action); // Note that $action and $object may have been modified by some hooks
{ if ($reshook < 0) {
$message = $hookmanager->error;
}
if (empty($reshook)) {
// Validate new password
if ($action == 'validatenewpassword' && $username && $passwordhash)
{
$edituser = new User($db); $edituser = new User($db);
$result = $edituser->fetch('', $_GET["username"]); $result = $edituser->fetch('', $_GET["username"]);
if ($result < 0) if ($result < 0)
@ -88,10 +95,10 @@ if ($action == 'validatenewpassword' && $username && $passwordhash)
$message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePasswordReset").'</div>'; $message = '<div class="error">'.$langs->trans("ErrorFailedToValidatePasswordReset").'</div>';
} }
} }
} }
// Action modif mot de passe // Action modif mot de passe
if ($action == 'buildnewpassword' && $username) if ($action == 'buildnewpassword' && $username)
{ {
$sessionkey = 'dol_antispam_value'; $sessionkey = 'dol_antispam_value';
$ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code']))); $ok = (array_key_exists($sessionkey, $_SESSION) === true && (strtolower($_SESSION[$sessionkey]) == strtolower($_POST['code'])));
@ -149,6 +156,7 @@ if ($action == 'buildnewpassword' && $username)
} }
} }
} }
}
} }