X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Flostpass.php;h=af4518ca16246292a9b8a18f8461797d9e9646e1;hb=82d55f120fd2163afaa57cd64c6a10a626abd2e5;hp=c8254d6ca3e7c9ffda0c0aea78026e2e0363c133;hpb=071b1c038addc94178eff22a47f0bf126b4a9d28;p=friendica.git
diff --git a/mod/lostpass.php b/mod/lostpass.php
index c8254d6ca3..af4518ca16 100644
--- a/mod/lostpass.php
+++ b/mod/lostpass.php
@@ -1,19 +1,18 @@
$pwdreset_token,
- 'pwdreset_time' => datetime_convert()
+ 'pwdreset_time' => DateTimeFormat::utcNow()
];
$result = dba::update('user', $fields, ['uid' => $user['uid']]);
if ($result) {
- info(t('Password reset request issued. Check your email.') . EOL);
+ info(L10n::t('Password reset request issued. Check your email.') . EOL);
}
$sitename = $a->config['sitename'];
$resetlink = System::baseUrl() . '/lostpass/' . $pwdreset_token;
- $preamble = deindent(t('
+ $preamble = deindent(L10n::t('
Dear %1$s,
A request was recently received at "%2$s" to reset your account
password. In order to confirm this request, please select the verification link
@@ -54,7 +53,7 @@ function lostpass_post(App $a)
Your password will not be changed unless we can verify that you
issued this request.', $user['username'], $sitename));
- $body = deindent(t('
+ $body = deindent(L10n::t('
Follow this link soon to verify your identity:
%1$s
@@ -70,7 +69,8 @@ function lostpass_post(App $a)
notification([
'type' => SYSTEM_EMAIL,
'to_email' => $user['email'],
- 'subject' => t('Password reset requested at %s', $sitename),
+ 'uid' => $user['uid'],
+ 'subject' => L10n::t('Password reset requested at %s', $sitename),
'preamble' => $preamble,
'body' => $body
]);
@@ -86,20 +86,20 @@ function lostpass_content(App $a)
$user = dba::selectFirst('user', ['uid', 'username', 'email', 'pwdreset_time'], ['pwdreset' => $pwdreset_token]);
if (!DBM::is_result($user)) {
- notice(t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
+ notice(L10n::t("Request could not be verified. \x28You may have previously submitted it.\x29 Password reset failed."));
return lostpass_form();
}
- // Password reset requests expire in 20 minutes
- if ($user['pwdreset_time'] < datetime_convert('UTC', 'UTC', 'now - 1 hour')) {
+ // Password reset requests expire in 60 minutes
+ if ($user['pwdreset_time'] < DateTimeFormat::utc('now - 1 hour')) {
$fields = [
'pwdreset' => null,
'pwdreset_time' => null
];
dba::update('user', $fields, ['uid' => $user['uid']]);
- notice(t('Request has expired, please make a new one.'));
+ notice(L10n::t('Request has expired, please make a new one.'));
return lostpass_form();
}
@@ -114,10 +114,10 @@ function lostpass_form()
{
$tpl = get_markup_template('lostpass.tpl');
$o = replace_macros($tpl, [
- '$title' => t('Forgot your Password?'),
- '$desc' => t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'),
- '$name' => t('Nickname or Email: '),
- '$submit' => t('Reset')
+ '$title' => L10n::t('Forgot your Password?'),
+ '$desc' => L10n::t('Enter your email address and submit to have your password reset. Then check your email for further instructions.'),
+ '$name' => L10n::t('Nickname or Email: '),
+ '$submit' => L10n::t('Reset')
]);
return $o;
@@ -126,18 +126,19 @@ function lostpass_form()
function lostpass_generate_password($user)
{
$o = '';
+ $a = get_app();
$new_password = User::generateNewPassword();
$result = User::updatePassword($user['uid'], $new_password);
if (DBM::is_result($result)) {
$tpl = get_markup_template('pwdreset.tpl');
$o .= replace_macros($tpl, [
- '$lbl1' => t('Password Reset'),
- '$lbl2' => t('Your password has been reset as requested.'),
- '$lbl3' => t('Your new password is'),
- '$lbl4' => t('Save or copy your new password - and then'),
- '$lbl5' => '' . t('click here to login') . '.',
- '$lbl6' => t('Your password may be changed from the Settings page after successful login.'),
+ '$lbl1' => L10n::t('Password Reset'),
+ '$lbl2' => L10n::t('Your password has been reset as requested.'),
+ '$lbl3' => L10n::t('Your new password is'),
+ '$lbl4' => L10n::t('Save or copy your new password - and then'),
+ '$lbl5' => '' . L10n::t('click here to login') . '.',
+ '$lbl6' => L10n::t('Your password may be changed from the Settings page after successful login.'),
'$newpass' => $new_password,
'$baseurl' => System::baseUrl()
]);
@@ -145,13 +146,13 @@ function lostpass_generate_password($user)
info("Your password has been reset." . EOL);
$sitename = $a->config['sitename'];
- $preamble = deindent(t('
+ $preamble = deindent(L10n::t('
Dear %1$s,
Your password has been changed as requested. Please retain this
- information for your records (or change your password immediately to
- something that you will remember).
+ information for your records ' . "\x28" . 'or change your password immediately to
+ something that you will remember' . "\x29" . '.
', $user['username']));
- $body = deindent(t('
+ $body = deindent(L10n::t('
Your login details are as follows:
Site Location: %1$s
@@ -164,7 +165,8 @@ function lostpass_generate_password($user)
notification([
'type' => SYSTEM_EMAIL,
'to_email' => $user['email'],
- 'subject' => t('Your password has been changed at %s', $sitename),
+ 'uid' => $user['uid'],
+ 'subject' => L10n::t('Your password has been changed at %s', $sitename),
'preamble' => $preamble,
'body' => $body
]);