email - Loopback Verify User with lb-mandrill-connector: Uncaught AssertionError: template name should be defined -
i'm trying send email mandrill through loopback user.verify
method i'm stucked in error:
uncaught assertionerror: template name should defined
googleing around found pr on loopback: https://github.com/strongloop/loopback/pull/1517/files
but seems has not been merged brake travisci tests...
from pr, tried workaround in code:
let options = { type: 'email', port: '80', to: ac.email, from: app.get('emailfrom'), subject: 'thanks registering.', verifyhref: verifyhref, template: null, user: ac }; var template = loopback.template(path.resolve(__dirname, '../../server/views/verify.ejs')); options.html = template(options);
but seems loopback set default template if no specified, suggestion?
i'm running on loopback#2.18
the solution here not user.verify
generate token , call user.save
, proceed call mandrill.
context.req.app.models.user.generateverificationtoken(user, function (err,token) { if (err) { return next(err); } user.verificationtoken = token; user.save(function (err) { if (err) { next(err); } else { var url = 'http://' + config.host + ':' + config.port + '/api/users/confirm?uid=2&redirect=/&token=' + token; var mandrill_client = new mandrill.mandrill('xxxx');
Comments
Post a Comment