Completed

This commit is contained in:
yashrajverma 2021-05-17 14:36:05 +05:30
parent 2c624b1040
commit a45d11c6c4
2 changed files with 17 additions and 17 deletions

View File

@ -32,7 +32,7 @@ module.exports.postSignup = async (req, res, next) => {
//we need firstName , lastName , email , password as input
let firstName = req.body.firstName || " ";
let lastName = req.body.lastName || " ";
const { sending_company_email, email, password, subject, _html } = req.body;
const { sending_company_email, email, password, subject } = req.body;
let user = await User.findOne({ email: email });
if (user) {
res.json({
@ -49,7 +49,7 @@ module.exports.postSignup = async (req, res, next) => {
email: email,
password: hashedPass,
isAdmin: false,
email_otp,
// email_otp,
});
user = await user.save();
await Student.deleteOne({ user: user._id });
@ -59,21 +59,21 @@ module.exports.postSignup = async (req, res, next) => {
student = await student.save();
user.student = student._id;
await user.save();
const message = {
from: `${sending_company_email}`, // Sender address
to: `${email}`, // List of recipients
subject: `${subject}`, // Subject line
html: `${_html}`, // design html for email message.
};
transport.sendMail(message, function (err, info) {
if (err) {
console.log(err);
} else {
console.log(info);
}
});
// const message = {
// from: `${sending_company_email}`, // Sender address
// to: `${email}`, // List of recipients
// subject: `${subject}`, // Subject line
// html: '', // design html for email message.
// };
// transport.sendMail(message, function (err, info) {
// if (err) {
// console.log(err);
// } else {
// console.log(info);
// }
// });
res.json({
message: "OTP has sent to the Email",
message: "You Are Registered, Please Login",
type: "success",
});
}

View File

@ -17,6 +17,6 @@ router.post("/forgotpassword", authController.forgotpassword);
router.post("/resetpassword/:_id/:token", authController.resetpassword);
router.post("/verifyemail", authController.verfiyemail);
// router.post("/verifyemail", authController.verfiyemail);
module.exports = router;