mirror of
https://github.com/Mueller-Patrick/Betterzon.git
synced 2024-11-12 17:43:57 +00:00
BETTERZON-145: Adding better error when trying to get session details without cookie
This commit is contained in:
parent
c35097a9a2
commit
391a4b5e4b
|
@ -95,6 +95,12 @@ usersRouter.post('/checkSessionValid', async (req: Request, res: Response) => {
|
|||
try {
|
||||
const ip: string = req.connection.remoteAddress ?? '';
|
||||
|
||||
if(!req.cookies.betterauth) {
|
||||
// Error logging in, probably wrong username / password
|
||||
res.status(401).send(JSON.stringify({messages: ['No session detected'], codes: [5]}));
|
||||
return;
|
||||
}
|
||||
|
||||
// Update the user entry and create a session
|
||||
const user: User = await UserService.checkSessionWithCookie(req.cookies.betterauth, ip);
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user