args[0]; $scene = $this->validation->getName(); $user_id = $data[$userField]; return self::check($user_id, $value, $scene); } /** * 检查 * * @param $user_id * @param $value * @return bool|int * @throws \PragmaRX\Google2FA\Exceptions\IncompatibleWithGoogleAuthenticatorException * @throws \PragmaRX\Google2FA\Exceptions\InvalidCharactersException * @throws \PragmaRX\Google2FA\Exceptions\SecretKeyTooShortException */ static public function check($user_id, $value, $scene = '') { $info = UserService::infoinfo($user_id); $google2fa = new \PragmaRX\Google2FA\Google2FA(); if (APP_DEBUG) { if ($info->google2fa_secret === '8888888888') { if ($value == '123456') { return true; }else{ return false; } } } $check = \App\Module\User\Services\Google2Fa::must_check($info, $scene); if($check){ $f = true; } if (empty($info->google2fa_secret)) { if ($f) { return false; } return true; } $valid = $google2fa->verifyKey($info->google2fa_secret, $value); return $valid; } }