Open max8hine opened 6 years ago
I think I know why, after checked the ./lib/email.js
in Keystone.
need to use keystone.get('email locals') to grab the data
It would be good to hard code in the keystone/lib/email.js since keystone-email dropped the default locals.
temperary solution:
User.schema.methods.resetPassword = function(callback) {
var user = this;
user.resetPasswordKey = keystone.utils.randomString([16,24]);
/** Get the emailLcals */
const emailLocals = keystone.get('email locals')
console.log(emailLocals)
user.save(function(err) {
if (err) return callback(err);
new keystone.Email('forgotten-password').send({
/** insert to the option object */
...emailLocals,
user: user,
link: '/reset-password/' + user.resetPasswordKey,
subject: 'Reset your SydJS Password',
to: user.email,
from: {
name: 'SydJS',
email: 'contact@sydjs.com'
}
}, callback);
});
}
I found this code snippet in the
keystone.js
it seems did not pass anything into the email template, is the 'email locals' is valid key for keystone.set('')?
(below is the screenshot from the receiving email)
the host url is missing in email.
Thank you in advance