mirror of
https://github.com/friendica/friendica
synced 2025-05-03 11:44:09 +02:00
Use Model\Register methods in modules
- Update registration emails to avoid storing the plaintext password in the register table - Remove redundant sprintf() when used with L10n::t() - Remove redundant Systen::baseUrl() with goaway()
This commit is contained in:
parent
123992384b
commit
540adaf829
6 changed files with 55 additions and 72 deletions
|
@ -412,7 +412,7 @@ class User
|
|||
throw new Exception(L10n::t('An invitation is required.'));
|
||||
}
|
||||
|
||||
if (!DBA::exists('register', ['hash' => $invite_id])) {
|
||||
if (!Register::existsByHash($invite_id)) {
|
||||
throw new Exception(L10n::t('Invitation could not be verified.'));
|
||||
}
|
||||
}
|
||||
|
@ -660,22 +660,31 @@ class User
|
|||
* @param string $email
|
||||
* @param string $sitename
|
||||
* @param string $username
|
||||
* @param string $password Plaintext password
|
||||
* @return NULL|boolean from notification() and email() inherited
|
||||
*/
|
||||
public static function sendRegisterPendingEmail($email, $sitename, $username)
|
||||
public static function sendRegisterPendingEmail($uid, $email, $sitename, $username, $siteurl, $nickname, $password)
|
||||
{
|
||||
$body = deindent(L10n::t('
|
||||
Dear %1$s,
|
||||
Thank you for registering at %2$s. Your account is pending for approval by the administrator.
|
||||
'));
|
||||
|
||||
$body = sprintf($body, $username, $sitename);
|
||||
Your login details are as follows:
|
||||
|
||||
Site Location: %3$s
|
||||
Login Name: %4$s
|
||||
Password: %5$s
|
||||
',
|
||||
$body, $username, $sitename, $siteurl, $nickname, $password
|
||||
));
|
||||
|
||||
return notification([
|
||||
'type' => SYSTEM_EMAIL,
|
||||
'type' => SYSTEM_EMAIL,
|
||||
'uid' => $uid,
|
||||
'to_email' => $email,
|
||||
'subject'=> L10n::t('Registration at %s', $sitename),
|
||||
'body' => $body]);
|
||||
'subject' => L10n::t('Registration at %s', $sitename),
|
||||
'body' => $body
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -695,7 +704,9 @@ class User
|
|||
$preamble = deindent(L10n::t('
|
||||
Dear %1$s,
|
||||
Thank you for registering at %2$s. Your account has been created.
|
||||
'));
|
||||
',
|
||||
$preamble, $username, $sitename
|
||||
));
|
||||
$body = deindent(L10n::t('
|
||||
The login details are as follows:
|
||||
|
||||
|
@ -722,19 +733,19 @@ class User
|
|||
|
||||
If you ever want to delete your account, you can do so at %3$s/removeme
|
||||
|
||||
Thank you and welcome to %2$s.'));
|
||||
|
||||
$preamble = sprintf($preamble, $username, $sitename);
|
||||
$body = sprintf($body, $email, $sitename, $siteurl, $username, $password);
|
||||
Thank you and welcome to %2$s.',
|
||||
$body, $email, $sitename, $siteurl, $username, $password
|
||||
));
|
||||
|
||||
return notification([
|
||||
'uid' => $user['uid'],
|
||||
'uid' => $user['uid'],
|
||||
'language' => $user['language'],
|
||||
'type' => SYSTEM_EMAIL,
|
||||
'type' => SYSTEM_EMAIL,
|
||||
'to_email' => $email,
|
||||
'subject'=> L10n::t('Registration details for %s', $sitename),
|
||||
'preamble'=> $preamble,
|
||||
'body' => $body]);
|
||||
'subject' => L10n::t('Registration details for %s', $sitename),
|
||||
'preamble' => $preamble,
|
||||
'body' => $body
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -771,7 +782,7 @@ class User
|
|||
if ($uid == local_user()) {
|
||||
unset($_SESSION['authenticated']);
|
||||
unset($_SESSION['uid']);
|
||||
goaway(System::baseUrl());
|
||||
goaway();;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue