Having issues with Accounts.onResetPasswordLink on IE 11

Does anyone have a full example, please, of Accounts.onResetPasswordLink with all the call backs including the done function as per http://docs.meteor.com/#/full/Accounts-onResetPasswordLink

I am having an issue on IE it seems be causing an issue with iron-router except clause. As per https://github.com/iron-meteor/iron-router/issues/1414 the weird things is it seems to work find with IE on my localhost test server, but when online I get the issue. It works fine online with other browsers (Chrome, FF & Safari).

So I am after a complete example to see if I am doing something wrong, pls?

I’m assuming the function should be used as this from reading the docs:

Accounts.onResetPasswordLink(function(token, done) {
	Accounts.resetPassword(token, "myPassword");

Thanks @benjick

as I have my own reset password, I need to store the token temporarily. So I had something like:

var done = function(){

    function(token, done){
            Session.set("passwordToken", token);
           //Accounts.resetPassword(token, "password");

So I wanted to go to my own create password template which would then call reset password

so, I was a bit confused by the done callback, within the other callback.

So how did you do it now? I guess you could call done() before the Router.go()

@benjick thanks

Ok, so now I was passing the token via a Session var. I just changed it to pass via URL ala:

    function(token, done){
        console.log("passwordToken", token);
        Session.set("passwordToken", token);
        //Accounts.resetPassword(token, "password");
        //Router.go('appCreatePassword',{query: 'token=' + token});
        Router.go('appCreatePassword',{_id: 1}, {query: 'token=' + token});


This works on Chrome, FF, Safari and IE (when on localhost), as does the old way (Session variable). But when running on my server (remotely) and access via the reset password link, it seems to reload Meteor differently and iron-router seems to ignore the except statement in the onBeforeAction:

Router.onBeforeAction(IR_BeforeHooks.isLoggedIn, {except: ['start','signIn','appCreatePassword'

Ie it should be ignoring this as appCreatePassword is on the except list.

Would there be a different way that IE processes this? I am a bit stumped here, maybe I am doing something wrong in my code??? happy to take any ideas?

I thought maybe I was doing the reset password thing incorrectly which was messing up the session stuff?

@benjick any more thoughts on this pls? I am not sure how I can get this to work?

Not sure, but I’d guess you could take a look at https://github.com/meteor/meteor/tree/devel/packages/accounts-ui-unstyled and see how they do it there

I actually change the URL to one that the router can just use with a paramater:

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

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

This will make the auto generated URL into just a normal URL.
Your router can just access the parameter whenever it needs.

1 Like

@cstrat thanks. This seems to work so far… based on initial test. Thanks heaps
@benjick thanks

I know this thread is pretty old, but are you doing all this from client?
If yes, is there a way to do if from server?

Thanks in advance,

No these settings are configured on the server.
The client has some default ways of interpreting the standard links to capture the tokens.
If you use the code I posted above, you use use your router to pull the tokens from the URLs.
I find these URLs are less prone to issues… however you need to create a dedicated route where the default way Meteor does it just sets a token variable and you can kind of intercept that on any route.