Rework user interface field API names
Jenkins Production Deployment

This commit is contained in:
2023-05-14 21:09:34 +02:00
parent 02f7424b56
commit 95983021ed
6 changed files with 42 additions and 42 deletions
+9 -9
View File
@@ -39,8 +39,8 @@ usersRouter.post('/register', async (req: Request, res: Response) => {
// Send the session details back to the user
res.status(201).send({
session_id: session.session_id,
session_key: session.session_key
sessionId: session.sessionId,
sessionKey: session.sessionKey
});
} catch (e: any) {
let errorGuid = Guid.create().toString();
@@ -69,16 +69,16 @@ usersRouter.post('/login', async (req: Request, res: Response) => {
// Create a session
const session: Session = await UserService.login(email, password, ip);
if (!session.session_id) {
if (!session.sessionId) {
// Error logging in, probably wrong username / password
res.status(401).send(JSON.stringify({messages: ['Wrong username and / or password']}));
res.status(401).send(JSON.stringify({message: 'Wrong username and / or password', sessionId: -1, sessionKey: ''}));
return;
}
// Send the session details back to the user
res.status(200).send({
session_id: session.session_id,
session_key: session.session_key
sessionId: session.sessionId,
sessionKey: session.sessionKey
});
} catch (e: any) {
let errorGuid = Guid.create().toString();
@@ -95,8 +95,8 @@ usersRouter.post('/login', async (req: Request, res: Response) => {
usersRouter.post('/checkSessionValid', async (req: Request, res: Response) => {
try {
const ip: string = req.socket.remoteAddress ?? '';
const session_id = req.body.session_id;
const session_key = req.body.session_key;
const session_id = req.body.sessionId;
const session_key = req.body.sessionKey;
if (!session_id || !session_key) {
// Error logging in, probably wrong username / password
@@ -106,7 +106,7 @@ usersRouter.post('/checkSessionValid', async (req: Request, res: Response) => {
const user: User = await UserService.checkSession(session_id, session_key, ip);
if (!user.user_id) {
if (!user.userId) {
// Error logging in, probably wrong username / password
res.status(401).send(JSON.stringify({messages: ['Invalid session']}));
return;