Trying to implement password recovery in my meteor app.
I can generate an recovery email which points to my app :
onemore.meteor.com/#/reset-Password/[token]
When I click on this link, it goes to the URL, but then the URL immediately rewrites to onemore.meteor.com/#
When I type Session.get("resetPassword")
, it returns undefined
I know the token is valid. If I copy the latter part of the link in the e-mail "[token]" and paste it into console, as Session.set("resetPassword",[token])
, the password recovery form acts as expected.
Why does my URL rewrite onload? Should this happen? Is there js that I need to interpret this before the rewrite?
Thanks
You might try removing the # from reset URL with something 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 do you change the reset password URL in meteor?
I think you need to add the route by yourself.
For iron router with coffeescript it may 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 the reset_password template.
You can set the URL as follows:
Meteor.startup(() => {
Accounts.urls.resetPassword= (token) => {
return Meteor.absoluteUrl('reset-password/' + token);
};
});
Thats better than replacing the whole email text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With