change backend create user + reset password hashing

This commit is contained in:
xiaomlove
2025-04-05 20:16:09 +07:00
parent 21fe7d6249
commit 1841f1377a

View File

@@ -124,7 +124,7 @@ class UserRepository extends BaseRepository
} }
$setting = Setting::get('main'); $setting = Setting::get('main');
$secret = mksecret(); $secret = mksecret();
$passhash = md5($secret . $password . $secret); $passhash = hash('sha256', $secret . hash('sha256', $password));
$data = [ $data = [
'username' => $username, 'username' => $username,
'email' => $email, 'email' => $email,
@@ -161,7 +161,7 @@ class UserRepository extends BaseRepository
$this->checkPermission($operator, $user); $this->checkPermission($operator, $user);
} }
$secret = mksecret(); $secret = mksecret();
$passhash = md5($secret . $password . $secret); $passhash = hash('sha256', $secret . hash('sha256', $password));
$update = [ $update = [
'secret' => $secret, 'secret' => $secret,
'passhash' => $passhash, 'passhash' => $passhash,