Return empty string when JWT auth failed
This commit is contained in:
parent
748c275969
commit
1a98e7937d
@ -259,7 +259,7 @@ class AuthController extends Controller
|
||||
$token = Auth::guard('jwt')->attempt([
|
||||
'email' => $request->email,
|
||||
'password' => $request->password
|
||||
]);
|
||||
]) ?: '';
|
||||
|
||||
return json(compact('token'));
|
||||
}
|
||||
|
@ -550,6 +550,11 @@ class AuthControllerTest extends TestCase
|
||||
'password' => '12345678'
|
||||
])->decodeResponseJson('token');
|
||||
$this->assertTrue(is_string($token));
|
||||
|
||||
$this->postJson('/api/auth/login', [
|
||||
'email' => $user->email,
|
||||
'password' => '123456789'
|
||||
])->assertJson(['token' => '']);
|
||||
}
|
||||
|
||||
public function testApiLogout()
|
||||
|
Loading…
Reference in New Issue
Block a user