fixes #2287 switch language before sending the email

This commit is contained in:
Linty 2024-12-04 15:07:06 +01:00
parent e2fbf45cd8
commit bb8f3d5715
2 changed files with 7 additions and 1 deletions

View file

@ -1023,7 +1023,9 @@ function ws_users_generate_password_link($params, &$service)
$first_login = has_already_logged_in($params['user_id']);
$generate_link = generate_password_link($params['user_id'], $first_login);
$send_by_mail_response = null;
$lang_to_use = $first_login ? get_default_language() : $user_lost['language'];
switch_lang_to($lang_to_use);
if ($params['send_by_mail'] and !empty($user_lost['email']))
{
if ($first_login)
@ -1044,6 +1046,7 @@ function ws_users_generate_password_link($params, &$service)
$send_by_mail_response = false;
}
}
switch_lang_back();
return array(
'generated_link' => $generate_link['password_link'],

View file

@ -80,9 +80,12 @@ function process_password_request()
// $userdata['activation_key'] = $generate_link['activation_key'];
switch_lang_to($userdata['language']);
$email_params = pwg_generate_reset_password_mail($userdata['username'], $generate_link['password_link'], $conf['gallery_title'], $generate_link['time_validation']);
$send_email = pwg_mail($userdata['email'], $email_params);
switch_lang_back();
if (pwg_mail($userdata['email'], $email_params))
if ($send_email)
{
$page['infos'][] = l10n('Check your email for the confirmation link');
return true;