Better Errors
This commit is contained in:
1 parent
30849019af
commit
85d20e034a
18 files changed
+567
-390
No files matched your search
@@ -16,14 +16,14 @@ class Auth implements IMiddleware
|
||||
|
||||
// No token
|
||||
if ($token === null) {
|
||||
Response::response()->httpCode(401)->json(["message" => "Not Authorized"]);
|
||||
Response::response()->httpCode(401)->json(["code" => "Unauthorized", "message" => "Not Authorized"]);
|
||||
}
|
||||
|
||||
try {
|
||||
User::getByToken($token);
|
||||
} catch (Exception $err) {
|
||||
// No user with this token exists
|
||||
Response::response()->httpCode(401)->json(["message" => "Not Authorized"]);
|
||||
Response::response()->httpCode(401)->json(["code" => "Unauthorized", "message" => "Not Authorized"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user