@ -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(
@ -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" },
},