changed the login from username to phone

master
varun 3 years ago
parent 08e5c6355f
commit 6199dcb8eb

@ -249,10 +249,10 @@ exports.addUser = async (req, reply) => {
exports.loginUser = async (req) => { exports.loginUser = async (req) => {
try { try {
const username = req.body.username; const phone = req.body.phone;
const password = req.body.password; 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 // compare users password with what is supplied
if (user) { if (user) {
isSame = await bcryptComparePassword( isSame = await bcryptComparePassword(

@ -152,9 +152,9 @@ fastify.post("/api/login", {
summary: "This is for User Login", summary: "This is for User Login",
body: { body: {
type: "object", type: "object",
required: ["username", "password"], required: ["phone", "password"],
properties: { properties: {
username: { type: "string" }, phone: { type: "string" },
password: { type: "string" }, password: { type: "string" },
}, },
}, },

Loading…
Cancel
Save