Search code examples
meteorreset-password

meteor sends a false generated link (#) by using "forgot your password" function


I activate the function "forgot your password?" in meteor. I got an email from meteor in my Inbox to reset the password, everything is woking fine, but the problem is in the generated link, because i got # in the Link. (see the link among)

http://localhost:3000/#/reset-password/8DhEtotkn0A0EU-
kShhmB6llHlfXpXCXAIqNYvrsZzi

When i remove the # from the link above and copypaste the link in my browser, then it's working fine.

where comes # in the link? and how can i remove it in my meteor project to get a correctly link to rest password?

help is needed, thanks


Solution

  • You can change this using the Accounts.urls.resetPassword function

    In your server/main.js file insert the following code:

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

    You can set whatever URL you want above.

    Also you can add more info to customise the email if you want:

    Meteor.startup(function() {
        Accounts.urls.resetPassword = function(token) {
            return Meteor.absoluteUrl('reset-password/' + token);
        };
        Accounts.emailTemplates.siteName = "Your Application Name";
        Accounts.emailTemplates.from = "Application Name <no-reply@yourdomain.com>";
    });