mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Added testing coverage to API token auth
This commit is contained in:
@ -35,7 +35,7 @@ class ApiAuthenticate
|
||||
}
|
||||
|
||||
if ($this->awaitingEmailConfirmation()) {
|
||||
return $this->emailConfirmationErrorResponse($request);
|
||||
return $this->emailConfirmationErrorResponse($request, true);
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
|
@ -26,9 +26,9 @@ trait ChecksForEmailConfirmation
|
||||
* Provide an error response for when the current user's email is not confirmed
|
||||
* in a system which requires it.
|
||||
*/
|
||||
protected function emailConfirmationErrorResponse(Request $request)
|
||||
protected function emailConfirmationErrorResponse(Request $request, bool $forceJson = false)
|
||||
{
|
||||
if ($request->wantsJson()) {
|
||||
if ($request->wantsJson() || $forceJson) {
|
||||
return response()->json([
|
||||
'error' => [
|
||||
'code' => 401,
|
||||
|
Reference in New Issue
Block a user