Merge branch '16.0' of git@github.com:Dolibarr/dolibarr.git into 17.0
This commit is contained in:
commit
b3b94e34d7
@ -2385,7 +2385,7 @@ class User extends CommonObject
|
||||
/**
|
||||
* Send new password by email
|
||||
*
|
||||
* @param User $user Object user that send the email (not the user we send too)
|
||||
* @param User $user Object user that send the email (not the user we send to) @todo object $user is not used !
|
||||
* @param string $password New password
|
||||
* @param int $changelater 0=Send clear passwod into email, 1=Change password only after clicking on confirm email. @todo Add method 2 = Send link to reset password
|
||||
* @return int < 0 si erreur, > 0 si ok
|
||||
@ -2451,6 +2451,9 @@ class User extends CommonObject
|
||||
//print $password.'-'.$this->id.'-'.$dolibarr_main_instance_unique_id;
|
||||
$url = $urlwithroot.'/user/passwordforgotten.php?action=validatenewpassword';
|
||||
$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($this->entity) ? $this->entity : 1);
|
||||
}
|
||||
|
||||
$msgishtml = 1;
|
||||
|
||||
|
||||
@ -90,7 +90,7 @@ if (empty($reshook)) {
|
||||
// Validate new password
|
||||
if ($action == 'validatenewpassword' && $username && $passworduidhash) {
|
||||
$edituser = new User($db);
|
||||
$result = $edituser->fetch('', $username);
|
||||
$result = $edituser->fetch('', $username, '', 0, $conf->entity);
|
||||
if ($result < 0) {
|
||||
$message = '<div class="error">'.dol_escape_htmltag($langs->trans("ErrorTechnicalError")).'</div>';
|
||||
} else {
|
||||
@ -126,9 +126,9 @@ if (empty($reshook)) {
|
||||
$isanemail = preg_match('/@/', $username);
|
||||
|
||||
$edituser = new User($db);
|
||||
$result = $edituser->fetch('', $username, '', 1);
|
||||
$result = $edituser->fetch('', $username, '', 1, $conf->entity);
|
||||
if ($result == 0 && $isanemail) {
|
||||
$result = $edituser->fetch('', '', '', 1, -1, $username);
|
||||
$result = $edituser->fetch('', '', '', 1, $conf->entity, $username);
|
||||
}
|
||||
|
||||
// Set the message to show (must be the same if login/email exists or not
|
||||
|
||||
Loading…
Reference in New Issue
Block a user