Add claude init file + refactor some security issues

This commit is contained in:
2026-05-02 12:22:03 +02:00
parent dc65b49219
commit da85d1487c
8 changed files with 177 additions and 49 deletions
+4 -4
View File
@@ -329,9 +329,9 @@ usersRouter.post('/login', async (req: Request, res: Response) => {
}
// Create a session
const session: Session = await UserService.login(email, password, ip);
const session: Session | null = await UserService.login(email, password, ip);
if (!session.sessionId) {
if (!session || !session.sessionId) {
// Error logging in, probably wrong username / password
res.status(401).send(JSON.stringify({message: 'Wrong username and / or password', sessionId: -1, sessionKey: ''}));
return;
@@ -426,9 +426,9 @@ usersRouter.post('/checkSessionValid', async (req: Request, res: Response) => {
return;
}
const user: User = await UserService.checkSession(session_id, session_key, ip);
const user: User | null = await UserService.checkSession(session_id, session_key, ip);
if (!user.userId) {
if (!user || !user.userId) {
// Error logging in, probably wrong username / password
res.status(401).send(JSON.stringify({messages: ['Invalid session']}));
return;