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

View File

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