Done!
This commit is contained in:
parent
51238a4d96
commit
812cc70ae9
|
@ -224,17 +224,25 @@ module.exports.postSignin = async (req, res, next) => {
|
|||
console.log("req.body", req.body);
|
||||
let user = await User.findOne({ email });
|
||||
if (isGoogle) {
|
||||
user.isVerified = true;
|
||||
user = await user.save();
|
||||
const isMatched = await bcrypt.compare(password, user.password);
|
||||
if (isMatched) {
|
||||
const token = jwt.sign({ _id: user._id }, JWT_secret);
|
||||
res.json({
|
||||
token: token,
|
||||
});
|
||||
if (user) {
|
||||
user.isVerified = true;
|
||||
user = await user.save();
|
||||
const isMatched = await bcrypt.compare(password, user.password);
|
||||
if (isMatched) {
|
||||
const token = jwt.sign({ _id: user._id }, JWT_secret);
|
||||
res.json({
|
||||
token: token,
|
||||
});
|
||||
} else {
|
||||
res.json({
|
||||
message: "email and password doesn't match",
|
||||
type: "error",
|
||||
});
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
res.json({
|
||||
message: "email and password doesn't match",
|
||||
message: "User Doesn't Exists",
|
||||
type: "error",
|
||||
});
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue