Skip to content

WIP: feat(password-reset): allow email options customization

Yannis Barlas requested to merge customize-password-reset-email into master

This allows custom options to be passed to the password reset email through the config.

  • If no custom options are found, it works just as it did before.
  • If the custom options are an object, then it gets merged with the current options.
  • Custom options can be a function, which should return an object, which will in turn be merged as for the point above.

A custom function (which is what I personally need) could look like this:

const customEmailOptions = passwordResetURL => {
  const content = `
    <p>
      Follow the link below to reset your password in the microPublication
      platform.
    </p>
    <p><a href="${passwordResetURL}">Reset your password</a></p>
  `

  return {
    html: content,
    subject: 'Micropublication | Password reset',
  }
}

Then in the config file, I'd add an entry like so:

'password-reset-server': {
  customEmailOptions,
},
Edited by Yannis Barlas

Merge request reports