mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-27 06:29:19 +08:00
Fix validating captcha
This commit is contained in:
parent
201fe21e6d
commit
8bd60624a0
@ -40,8 +40,7 @@ class AuthController extends Controller
|
|||||||
$user = $users->get($identification, $authType);
|
$user = $users->get($identification, $authType);
|
||||||
|
|
||||||
if (session('login_fails', 0) > 3) {
|
if (session('login_fails', 0) > 3) {
|
||||||
if (strtolower($request->input('captcha')) != strtolower(session('phrase')))
|
$this->validate($request, ['captcha' => 'required|captcha']);
|
||||||
return json(trans('auth.validation.captcha'), 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $user) {
|
if (! $user) {
|
||||||
|
@ -93,18 +93,14 @@ class AuthControllerTest extends TestCase
|
|||||||
$this->flushSession();
|
$this->flushSession();
|
||||||
|
|
||||||
// Should check captcha if there are too many fails
|
// Should check captcha if there are too many fails
|
||||||
$this->withSession(
|
$this->withSession(['login_fails' => 4])
|
||||||
[
|
->postJson(
|
||||||
'login_fails' => 4
|
|
||||||
]
|
|
||||||
)->postJson(
|
|
||||||
'/auth/login', [
|
'/auth/login', [
|
||||||
'identification' => $user->email,
|
'identification' => $user->email,
|
||||||
'password' => '12345678',
|
'password' => '12345678',
|
||||||
'captcha' => 'b'
|
|
||||||
])->assertJson([
|
])->assertJson([
|
||||||
'errno' => 1,
|
'errno' => 1,
|
||||||
'msg' => trans('auth.validation.captcha')
|
'msg' => trans('validation.required', ['attribute' => 'captcha'])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$this->flushSession();
|
$this->flushSession();
|
||||||
|
Loading…
Reference in New Issue
Block a user