Skip to content

Commit 7e4c9b0

Browse files
committed
restore auth code before merge conflict resolution
1 parent 3c23427 commit 7e4c9b0

2 files changed

Lines changed: 2 additions & 21 deletions

File tree

src/controllers/authcontroller.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const login = async (req, res) => {
1717
const user = await User.findOne({
1818
email: { $regex: new RegExp(`^${email}$`, 'i') },
1919
role: { $regex: new RegExp(`^${role}$`, 'i') },
20-
}).select('email role status password, mustchangepassword');
20+
}).select('email role status password');
2121
if (!user) {
2222
return res.status(401).json({ success: false, message: 'Invalid role or email' });
2323
}
@@ -35,15 +35,6 @@ export const login = async (req, res) => {
3535
return res.status(403).json({ success: false, message: "Your account is currently inactive. Kindly reach out to the admin for support." });
3636
}
3737

38-
if (user.mustchangepassword) {
39-
return res.status(200).json({
40-
success: true,
41-
reuirePasswordChange: true,
42-
message: "You are required to change your password before proceeding.",
43-
email: user.email,
44-
});
45-
}
46-
4738
const token = jwt.sign(
4839
{ id: user._id, role: user.role, email: user.email },
4940
process.env.JWT_SECRET,

src/models/User.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,15 @@ const userSchema = new mongoose.Schema({
7272
match: /.+@.+\..+/
7373
},
7474

75-
patientId: {
76-
type: mongoose.Schema.Types.ObjectId,
77-
ref: "Patient"
78-
},
79-
8075
password: {
8176
type: String,
8277
required: true
8378
},
8479

85-
mustChangePassword: {
86-
type: Boolean,
87-
default: false
88-
},
89-
9080
role: {
9181
type: String,
9282
required: true,
93-
enum: ['admin', 'doctor','receptionist','billing','patient']
83+
enum: ['admin', 'doctor','receptionist','billing', 'patient']
9484
},
9585

9686
name: { type: String },

0 commit comments

Comments
 (0)