From 6199dcb8eb84f95a4bbd64815dc474fd7f0586d5 Mon Sep 17 00:00:00 2001 From: varun Date: Mon, 6 Feb 2023 00:56:22 -0500 Subject: [PATCH] changed the login from username to phone --- src/controllers/userController.js | 4 ++-- src/index.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controllers/userController.js b/src/controllers/userController.js index 7be6f529..ba964c30 100644 --- a/src/controllers/userController.js +++ b/src/controllers/userController.js @@ -249,10 +249,10 @@ exports.addUser = async (req, reply) => { exports.loginUser = async (req) => { try { - const username = req.body.username; + const phone = req.body.phone; const password = req.body.password; - const user = await User.findOne({ username: username }); + const user = await User.findOne({ phone: phone }); // compare users password with what is supplied if (user) { isSame = await bcryptComparePassword( diff --git a/src/index.js b/src/index.js index b005163f..eed73b28 100644 --- a/src/index.js +++ b/src/index.js @@ -152,9 +152,9 @@ fastify.post("/api/login", { summary: "This is for User Login", body: { type: "object", - required: ["username", "password"], + required: ["phone", "password"], properties: { - username: { type: "string" }, + phone: { type: "string" }, password: { type: "string" }, }, },