FIX request new password with "mc" and "twofactor" authentication
This commit is contained in:
parent
83071df214
commit
992fe1286d
@ -2425,6 +2425,9 @@ class User extends CommonObject
|
|||||||
//print $password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id;
|
//print $password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id;
|
||||||
$url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword';
|
$url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword';
|
||||||
$url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id));
|
$url .= '&username='.urlencode($this->login)."&passworduidhash=".urlencode(dol_hash($password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id));
|
||||||
|
if (!empty($conf->multicompany->enabled)) {
|
||||||
|
$url .= '&entity='.(!empty($user->entity) ? $user->entity : 1);
|
||||||
|
}
|
||||||
|
|
||||||
$msgishtml = 1;
|
$msgishtml = 1;
|
||||||
|
|
||||||
|
|||||||
@ -87,7 +87,7 @@ if (empty($reshook)) {
|
|||||||
// Validate new password
|
// Validate new password
|
||||||
if ($action == 'validatenewpassword' && $username && $passworduidhash) {
|
if ($action == 'validatenewpassword' && $username && $passworduidhash) {
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
$result = $edituser->fetch('', $username);
|
$result = $edituser->fetch('', $username, '', 0, $conf->entity);
|
||||||
if ($result < 0) {
|
if ($result < 0) {
|
||||||
$message = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'</div>';
|
$message = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorLoginDoesNotExists", $username)).'</div>';
|
||||||
} else {
|
} else {
|
||||||
@ -122,9 +122,9 @@ if (empty($reshook)) {
|
|||||||
$isanemail = preg_match('/@/', $username);
|
$isanemail = preg_match('/@/', $username);
|
||||||
|
|
||||||
$edituser = new User($db);
|
$edituser = new User($db);
|
||||||
$result = $edituser->fetch('', $username, '', 1);
|
$result = $edituser->fetch('', $username, '', 1, $conf->entity);
|
||||||
if ($result == 0 && $isanemail) {
|
if ($result == 0 && $isanemail) {
|
||||||
$result = $edituser->fetch('', '', '', 1, -1, $username);
|
$result = $edituser->fetch('', '', '', 1, $conf->entity, $username);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result <= 0 && $edituser->error == 'USERNOTFOUND') {
|
if ($result <= 0 && $edituser->error == 'USERNOTFOUND') {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user