update: support md5 with sha256

This commit is contained in:
tokumeikoi 2021-09-14 13:12:44 +09:00
parent 0374a03892
commit 5d6010045d
3 changed files with 3 additions and 1 deletions

View File

@ -256,6 +256,7 @@ class AuthController extends Controller
}
$user->password = password_hash($request->input('password'), PASSWORD_DEFAULT);
$user->password_algo = NULL;
$user->password_salt = NULL;
if (!$user->save()) {
abort(500, __('Reset failed'));
}

View File

@ -43,6 +43,7 @@ class UserController extends Controller
}
$user->password = password_hash($request->input('new_password'), PASSWORD_DEFAULT);
$user->password_algo = NULL;
$user->password_salt = NULL;
if (!$user->save()) {
abort(500, __('Save failed'));
}

View File

@ -69,7 +69,7 @@ class Helper
switch($algo) {
case 'md5': return md5($password) === $hash;
case 'sha256': return hash('sha256', $password) === $hash;
case 'mws': return md5($password . $salt) === $hash;
case 'md5salt': return md5($password . $salt) === $hash;
default: return password_verify($password, $hash);
}
}