diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index 09f78a7d044..e20c1ca527b 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1972,12 +1972,12 @@ class User extends CommonObject /** * Send new password by email * - * @param User $fuser Object user that send email + * @param User $user Object user that send the email (not the user we send too) * @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 */ - public function send_password($fuser, $password = '', $changelater = 0) + public function send_password($user, $password = '', $changelater = 0) { // phpcs:enable global $conf, $langs; @@ -1997,8 +1997,9 @@ class User extends CommonObject { // If user has defined its own language (rare because in most cases, auto is used) $outputlangs->getDefaultLang($this->conf->MAIN_LANG_DEFAULT); } - if ($fuser->conf->MAIN_LANG_DEFAULT) { - $outputlangs->setDefaultLang($fuser->conf->MAIN_LANG_DEFAULT); + + if ($this->conf->MAIN_LANG_DEFAULT) { + $outputlangs->setDefaultLang($this->conf->MAIN_LANG_DEFAULT); } else { // If user has not defined its own language, we used current language @@ -2028,7 +2029,7 @@ class User extends CommonObject $mesg .= $outputlangs->transnoentitiesnoconv("ClickHereToGoTo", $appli).': '.$url."\n\n"; $mesg .= "--\n"; - $mesg .= $fuser->getFullName($outputlangs); // Username that make then sending + $mesg .= $user->getFullName($outputlangs); // Username that send email dol_syslog(get_class($this)."::send_password changelater is off, url=".$url); } @@ -2048,7 +2049,7 @@ class User extends CommonObject dol_syslog(get_class($this)."::send_password changelater is on, url=".$url); } - $trackid = 'use'.$fuser->id; + $trackid = 'use'.$this->id; $mailfile = new CMailFile( $subject, diff --git a/htdocs/user/passwordforgotten.php b/htdocs/user/passwordforgotten.php index 0afa158ec58..81e6779b80b 100644 --- a/htdocs/user/passwordforgotten.php +++ b/htdocs/user/passwordforgotten.php @@ -131,7 +131,7 @@ if ($action == 'buildnewpassword' && $username) else { // Success - if ($edituser->send_password($edituser, $newpassword, 1) > 0) + if ($edituser->send_password($user, $newpassword, 1) > 0) { $message = '