We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When I want to send an email to user when, is sends an email firstly created?
const crypto = require("crypto"); const User = require("../models/user"); const nodemailer = require("nodemailer"); const sendgridTransport = require("nodemailer-sendgrid-transport"); const bcrypt = require("bcryptjs"); const transporter = nodemailer.createTransport( sendgridTransport({ auth: { api_key: "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" } }) ); exports.postReset = (req, res, next) => { crypto.randomBytes(32, (err, buffer) => { if (err) { console.log(err); return res.redirect("/reset"); } const token = buffer.toString("hex"); User.findOne({ email: req.body.email }) .then(user => { if (!user) { req.flash("error", "No account with that email found."); return res.redirect("/reset"); } user.resetToken = token; user.resetTokenExpiration = Date.now() + 10200000; return user.save(); }) .then(result => { res.redirect("/"); transporter.sendMail( { to: req.body.email, from: "[email protected]", subject: "Password reset", html: ` <p>You requested a password reset</p> <p>Click this <a href="http://localhost:3000/reset/${token}">link</a> to set a new password</p> ` }, (err, info) => { console.log(info.envelope); console.log(info.messageId); } ); }) .catch(err => console.log(err)); }); };
But I got this message when resetting an email sent:
You requested a password reset Click this link to set a new password dfsdfasdfadfads
You requested a password reset
Click this link to set a new password
dfsdfasdfadfads
What is the reason for this?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
When I want to send an email to user when, is sends an email firstly created?
But I got this message when resetting an email sent:
What is the reason for this?
The text was updated successfully, but these errors were encountered: