Add claude init file + refactor some security issues
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user