From 172798008ff73b55c1d01b216120bcdd49cf5503 Mon Sep 17 00:00:00 2001 From: Leander Tolksdorf <leander.tolksdorf@fu-berlin.de> Date: Sat, 29 Jan 2022 13:31:46 +0100 Subject: [PATCH] rename /api/login body parameter "username" to "email" --- server/src/controllers/auth.controllers.ts | 4 ++-- server/src/routes/auth.routes.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/server/src/controllers/auth.controllers.ts b/server/src/controllers/auth.controllers.ts index 07730eb..c7625a8 100644 --- a/server/src/controllers/auth.controllers.ts +++ b/server/src/controllers/auth.controllers.ts @@ -7,12 +7,12 @@ import envVars from "../config"; //log in const authLoginController = async (req: Request, res: Response) => { try { - const { username, password } = req.body; + const { username: email, password } = req.body; const employee = await Employee.findOne({ attributes: ["email", "password", "role"], where: { - email: username, + email: email, }, }); diff --git a/server/src/routes/auth.routes.ts b/server/src/routes/auth.routes.ts index c4cce49..f6601bc 100644 --- a/server/src/routes/auth.routes.ts +++ b/server/src/routes/auth.routes.ts @@ -8,7 +8,7 @@ const authRouter = Router(); //log in route authRouter.post( "/api/login/", - body("username").isEmail().normalizeEmail(), + body("email").isEmail().normalizeEmail(), body("password").not().isEmpty(), handleValidationResult, authControllers.authLoginController -- GitLab