Skip to content
Snippets Groups Projects
Commit 17279800 authored by Leander Tolksdorf's avatar Leander Tolksdorf
Browse files

rename /api/login body parameter "username" to "email"

parent 39f675a3
No related branches found
No related tags found
No related merge requests found
......@@ -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,
},
});
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment