Meteor password reset - clicking on the email link does not work

Trying to implement password recovery in my meteor application.

I can create a recovery email that points to my application:

onemore.meteor.com/#/reset-Password/[token]

When I click on this link, it goes to the URL, but then the URL is immediately rewritten to onemore.meteor.com/#

When I type Session.get("resetPassword") , it returns undefined

I know that the token is valid. If I copy the last part of the link in the email "[token" "and paste it into the console like Session.set("resetPassword",[token]) , the password recovery form acts as expected.

Why is my URL rewriting onload? Should this happen? Is there any js that I need to interpret this before rewriting?

thanks

+7
url meteor hash token
source share
3 answers

You can try removing # from the reset url like this:

 Meteor.startup(function () { Accounts.emailTemplates.resetPassword.text = function (user, url) { url = url.replace('#/', '') return " To reset your password, simply click the link below:\n\n" + url; }; }); 

See also How to change the reset password url in a meteor?

+1
source share

I think you need to add the route yourself.

For an iron router with coffeescript, he might like

 Router.route '#/reset_password/:token', name: 'reset_password' onBeforeAction: ()-> if Meteor.userId() then this.redirect('/') else this.next() Accounts._resetPasswordToken = this.params.token 

And you should also add a reset_password template.

0
source share

I have had this problem for a long time and it is finally resolved.

As it turns out, the process that executes the reset password stores the resetPasswordToken in your session variables.

In my case, I cleared all session variables whenever userId changed, which would destroy the token that turned off the appearance of the dialog.

Now I only clear the session variables that I use (instead of calling Session.clear ()), and the problem has finally been resolved.

0
source share

All Articles