File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -477,6 +477,10 @@ module.exports = function(User) {
477477 function setHtmlContentAndSend ( html ) {
478478 options . html = html ;
479479
480+ // Remove options.template to prevent rejection by certain
481+ // nodemailer transport plugins.
482+ delete options . template ;
483+
480484 Email . send ( options , function ( err , email ) {
481485 if ( err ) {
482486 fn ( err ) ;
Original file line number Diff line number Diff line change @@ -1668,6 +1668,24 @@ describe('User', function() {
16681668 done ( ) ;
16691669 } ) ;
16701670 } ) ;
1671+
1672+ it ( 'removes "options.template" from Email payload' , function ( ) {
1673+ var MailerMock = {
1674+ send : function ( options , cb ) { cb ( null , options ) ; } ,
1675+ } ;
1676+
1677+ return User . create ( { email : 'user@example.com' , password : 'pass' } )
1678+ . then ( function ( user ) {
1679+ return user . verify ( {
1680+ type : 'email' ,
1681+ from : 'noreply@example.com' ,
1682+ mailer : MailerMock ,
1683+ } ) ;
1684+ } )
1685+ . then ( function ( result ) {
1686+ expect ( result . email ) . to . not . have . property ( 'template' ) ;
1687+ } ) ;
1688+ } ) ;
16711689 } ) ;
16721690
16731691 describe ( 'User.confirm(options, fn)' , function ( ) {
You can’t perform that action at this time.
0 commit comments