refactor: rename generatePassword to passwordToHash

This commit is contained in:
grandeljay 2023-08-30 13:19:45 +02:00
parent e9798a01fe
commit 749f247261
4 changed files with 6 additions and 6 deletions

View file

@ -36,7 +36,7 @@ class User
throw new \Exception('Unable to find user with ID ' . $user_id . '. Does it exist?');
}
public static function generatePassword(string $plainPassword): string
public static function passwordToHash(string $plainPassword): string
{
return sha1($plainPassword);
}

View file

@ -15,7 +15,7 @@ $page = new Page(__FILE__, __('Login'));
*/
if (isset($_POST['login'], $_POST['email'], $_POST['password'])) {
$email = Sanitiser::getEmail($_POST['email']);
$password = User::generatePassword($_POST['password']);
$password = User::passwordToHash($_POST['password']);
$database
->query(

View file

@ -79,7 +79,7 @@ if (isset($_POST['user-id'], $_POST['section'])) {
&& !empty($_POST['user-password-repeat'])
&& $_POST['user-password'] === $_POST['user-password-repeat']
) {
$set[] = '`password` = "' . User::generatePassword($_POST['user-password']) . '"';
$set[] = '`password` = "' . User::passwordToHash($_POST['user-password']) . '"';
$loginRequired = true;
}

View file

@ -92,7 +92,7 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
`password_reset_valid_until` = NULL
WHERE `id` = :user_id;',
array(
'user_password' => User::generatePassword($_POST['password']),
'user_password' => User::passwordToHash($_POST['password']),
'user_id' => $user->id,
)
);
@ -133,7 +133,7 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
);',
array(
'user_email' => $user_email,
'user_password' => User::generatePassword($_POST['password']),
'user_password' => User::passwordToHash($_POST['password']),
'user_language' => $locale_user,
)
);
@ -157,7 +157,7 @@ if (isset($_POST['email'], $_POST['password']) && !empty($_POST['planet'])) {
);',
array(
'user_email' => $user_email,
'user_password' => User::generatePassword($_POST['password']),
'user_password' => User::passwordToHash($_POST['password']),
'user_language' => $locale_user,
)
);