mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Replace DB::isValidOldPassword() with Rhymix's own implementation
This commit is contained in:
parent
77ab5cf870
commit
d2f24dcd12
1 changed files with 7 additions and 13 deletions
|
|
@ -614,22 +614,16 @@ class DB
|
|||
*/
|
||||
public function isValidOldPassword(string $password, string $saved_password): bool
|
||||
{
|
||||
$stmt = $this->_handle->prepare('SELECT' . ' ' . 'PASSWORD(?) AS pw1, OLD_PASSWORD(?) AS pw2');
|
||||
$stmt->execute([$password, $password]);
|
||||
$result = $this->_fetch($stmt);
|
||||
if ($this->isError() || !$result)
|
||||
if ($saved_password && substr($saved_password, 0, 1) === '*')
|
||||
{
|
||||
return false;
|
||||
return Password::checkPassword($password, $saved_password, 'mysql_new_password');
|
||||
}
|
||||
if ($saved_password && strlen($saved_password) === 16)
|
||||
{
|
||||
return Password::checkPassword($password, $saved_password, 'mysql_old_password');
|
||||
}
|
||||
|
||||
if ($result->pw1 === $saved_password || $result->pw2 === $saved_password)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue