is_active checking in user login
This commit is contained in:
parent
25576a2627
commit
fbda6dfd8b
@ -32,9 +32,9 @@ exports.login = async (req, res) => {
|
|||||||
const { email, password } = req.body;
|
const { email, password } = req.body;
|
||||||
|
|
||||||
userRole = 'EstablishmentUser'
|
userRole = 'EstablishmentUser'
|
||||||
userData = await EstablishmentUser.findOne({ where: { email } });
|
userData = await EstablishmentUser.findOne({ where: { email, is_active : { [Op.or]: [true, 1] } } });
|
||||||
if (!userData) {
|
if (!userData) {
|
||||||
userData = await User.findOne({ where: { email } });
|
userData = await User.findOne({ where: { email, is_active : { [Op.or]: [true, 1] } } });
|
||||||
userRole = 'Admin'
|
userRole = 'Admin'
|
||||||
if (!userData) res.status(404).send({'status':"failed",'message':"User not found",'data': ""});
|
if (!userData) res.status(404).send({'status':"failed",'message':"User not found",'data': ""});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user