changes in login ,added staff login to main login

master^2
Varun 9 months ago
parent 76c047e26b
commit 15a035c310

@ -270,6 +270,7 @@ fastify.post("/api/login", {
for (const currentUser of allUsers) { for (const currentUser of allUsers) {
const staffMember = currentUser.staff.staff.find(staff => staff.phone === phone && staff.status === "active"); const staffMember = currentUser.staff.staff.find(staff => staff.phone === phone && staff.status === "active");
if (staffMember && staffMember.password === password) { if (staffMember && staffMember.password === password) {
const token = fastify.jwt.sign( const token = fastify.jwt.sign(
{ {
name: staffMember.name, name: staffMember.name,
@ -286,7 +287,21 @@ fastify.post("/api/login", {
name: staffMember.name, name: staffMember.name,
phone: staffMember.phone, phone: staffMember.phone,
customerId: currentUser.customerId, customerId: currentUser.customerId,
buildingName: currentUser.buildingName,
email: currentUser.emails,
address1: currentUser.address1,
address2: currentUser.address2,
phoneVerified: true,
latitude: currentUser.latitude,
longitude: currentUser.longitude,
type: "staff",
message: "Staff login successful", message: "Staff login successful",
}, },
}); });
} }

Loading…
Cancel
Save