Skip to content
Snippets Groups Projects
Commit c98ca1e8 authored by alrwasheda's avatar alrwasheda :speech_balloon:
Browse files

email -> username according to endpoint

parent 2ba1a654
No related branches found
No related tags found
No related merge requests found
...@@ -7,12 +7,12 @@ import envVars from "../config"; ...@@ -7,12 +7,12 @@ import envVars from "../config";
//log in //log in
const authLoginController = async (req: Request, res: Response) => { const authLoginController = async (req: Request, res: Response) => {
try { try {
const { email, password } = req.body; const { username, password } = req.body;
const employee = await Employee.findOne({ const employee = await Employee.findOne({
attributes: ["email", "password", "role"], attributes: ["email", "password", "role"],
where: { where: {
email: email, email: username,
}, },
}); });
......
...@@ -8,7 +8,7 @@ const authRouter = Router(); ...@@ -8,7 +8,7 @@ const authRouter = Router();
//log in route //log in route
authRouter.post( authRouter.post(
"/api/login/", "/api/login/",
body("email").isEmail().normalizeEmail(), body("username").isEmail().normalizeEmail(),
body("password").not().isEmpty(), body("password").not().isEmpty(),
handleValidationResult, handleValidationResult,
authControllers.authLoginController 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