更新
This commit is contained in:
@@ -56,10 +56,27 @@ class LoginValidate extends BaseValidate
|
||||
* @date 2021/7/2 14:00
|
||||
*/
|
||||
public function password($password, $other, $data)
|
||||
{
|
||||
return $this->checkCredentialPassword($password, $data, true);
|
||||
}
|
||||
|
||||
/** 子系统直接验密保留原限流,始终忽略本地调试免密开关。 */
|
||||
public function strictPassword($password, $other, $data)
|
||||
{
|
||||
return $this->checkCredentialPassword($password, $data, false);
|
||||
}
|
||||
|
||||
public function sceneVerify()
|
||||
{
|
||||
return $this->only(['account', 'password'])->remove('password', 'password')
|
||||
->append('password', 'strictPassword');
|
||||
}
|
||||
|
||||
private function checkCredentialPassword($password, array $data, bool $allowDebug)
|
||||
{
|
||||
// 本地调试:免密登录开关。须同时满足 APP_DEBUG=1 + LOCAL_DEBUG.LOGIN_SKIP_PASSWORD=true,
|
||||
// 任一不满足都走原始密码校验。每次免密登录都会记一条 warning 日志,便于发现误开。
|
||||
if (self::isLocalDebugLoginBypassEnabled()) {
|
||||
if ($allowDebug && self::isLocalDebugLoginBypassEnabled()) {
|
||||
$adminInfo = Admin::where('account', '=', $data['account'])
|
||||
->field(['password,disable'])
|
||||
->findOrEmpty();
|
||||
|
||||
Reference in New Issue
Block a user