Reset Password custom template

Hi All:

In my Meteor-Angular app, I’m trying to customize the email that is sent with a sendPasswordReset request.
I’ve created a emails.ts file on the server side with the following:

import { Accounts } from 'meteor/accounts-base';

Accounts.emailTemplates.siteName = "Site Test";
Accounts.emailTemplates.from = "";

Accounts.emailTemplates.resetPassword = {
    subject() {
        return "[test] Reset Password Request";
    text( user, url ) {
        let emailAddress = user.emails[0].address,
        urlWithOutHash = url.replace( '#/', '' ),
        emailBody = `We received an account recovery request on for {{emailAddress}}.\n\n
        If you initiated this request, click this link to reset your password.\n
        If you did not initiate this account recovery request, just ignore this email. We'll keep your account safe.`
        return emailBody;

However, every time I submit a recover password request I received the canned response:


To reset your password, simply click the link below. 



Any suggestions would be appreciated.


It looks like you want to change the URL that gets generated, this is what I use:
(there is a URL generator you might not know about)

Accounts.urls.resetPassword = function(token) {
  return Meteor.absoluteUrl('reset/' + token);

I just realised that your template isn’t being used at all!
The comment above still stands.
Where are you running that server code?
Are you sure you are including that file in the startup sequence of the server block???
Put a couple console.log() statements in to see if the meteor server console spits it back…

1 Like

You’re awesome!

Thanks for the quick response.
Changing the URL was exactly what I was going for and I didn’t include the code in the startup.
Your suggestions worked.

Thanks again!

No problem!
I do the same thing every now and then, just forget the file isn’t actually being run anywhere yet!