Password Reset Error After Upgrading to 1.4.4.1

When I call Accounts.resetPassword with the new password it immediately throws the following error in the console:

Exception from sub enrolledUser id yabvxxPZgmtq6rLie undefined

yabvxxPZgmtq6rLie is not a valid user id so no idea where that is coming from.

This error is not returned by Accounts.resetPassword callback so my change PW view just hangs waiting…

Funny part is that the password is actually changed.

Does anyone have any ideas about what this could be

Detail a little more what you have to help you

Well the Accounts.resetPassword fails right away with the error I posted and never does the callback.

The user reset info is cleared and the pw changed.

I was going to look harder to find the source of the message to see if I can’t figure out what’s failing.

The id in the error message does not match any user… it’s like a random id - maybe pulling it out of the reset token incorrectly.

I can give you as I did if it serves you? When you ask a question always try to put more material like codes and images to help you better.



Template.ResetPwd.onRendered(function() {
    Ladda.stopAll();
    $('#form-messages').html("");
});


Template.ResetPwd.events({
    'click .inputStyleLP': function() {
        $('#form-messages').html('');
        Ladda.stopAll();
    },
    'submit #forgot-password': function(event, template) {
        event.preventDefault();
        var forgotPasswordForm = $(event.currentTarget),
            email = forgotPasswordForm.find('#forgotPasswordEmail').val();
        var bt = template.find('[name="submitSpinner"]');
        var l = Ladda.create(bt);
        l.start();

        if (email !== "") {
            Accounts.forgotPassword({
                email: email
            }, function(err) {
                if (err) {
                    if (err.message === 'User not found [403]') {
                        console.log('This email does not exist.');
                        $('#form-messages').html(err.message);
                    } else {
                        console.log('We are sorry but something went wrong.');
                        $('#form-messages').html('We are sorry but something went wrong.');
                    }
                } else {
                    console.log('Email Sent. Check your mailbox.');
                    $('#form-messages').html('Email Sent. Check your mailbox.');
                }
            });

        } else {
            $('#form-messages').html('Email Invalido');
        }
        template.find('[name="email"]').value = "";
        Ladda.stopAll();
        return false;
    }
});

Template.setNewPass.onRendered(function() {
    Ladda.stopAll();
    $('#form-messages').html("");
});

Template.setNewPass.events({
    'click .inputStyleLP': function() {
        $('#form-messages').html('');
        Ladda.stopAll();
    },
    'submit #set-new-password': function(e, template) {
        e.preventDefault();
        var target = event.target;
        var password = target.resetpass.value;
        var passwordConfirm = target.verificy.value;
        var appId = FlowRouter.getParam("token");
        var bt = template.find('[name="submitSpinner"]');
        //console.log(bt);
        var l = Ladda.create(bt);
        l.start();
        if (password === passwordConfirm) {
            Accounts.resetPassword(appId, password, function(err) {
                if (err) {
                    // console.log('We are sorry but something went wrong.');
                } else {
                    //  console.log('Your password has been changed. Welcome back!');
                        Ladda.stopAll();
                    Session.set('resetPassword', null);
                    Meteor.logout();
                    FlowRouter.go('backtoapp');
                }
            });
        } else {
            // FlashMessages.sendWarning('contraseñas no son iguales',
        }
        return false;
    }
});


/*lib/router.js*/
FlowRouter.route('/reset/:token', {
  name: "reset",
  action: function(params, queryParams) {
    BlazeLayout.render('indexLayout', {
      header: "Header",
      main: "setNewPass",
    });
  }
});

So I guess what I am saying is the part where you have:

Accounts.resetPassword(appId, password, function(err) {

It never actually comes back but blows up on the server side with error and never returns so my UI just hangs.

Exception from sub enrolledUser id yabvxxPZgmtq6rLie undefined

The code I have mimics what you’re doing for the most part - but if the Accounts.resetPassword never comes back…

try this console.log(appId)

You must have the code on the client side.

As I mentioned the ID is not of a user

Assuming you have a valid token

Then you can trace the meteor code on the server side using node-inspector. This looks like the server side method: https://github.com/meteor/meteor/blob/6a9f8b904425efce112103f3846d7a153f8988ca/packages/accounts-password/password_server.js#L694

The other thing to help understand what is going on is to examine the resetPassword token. Which should be in the users collection. The token will be in the document of the target user. I find using robomongo to be a great way to sift through these types of things.

If you haven’t used RoboMongo or node-inspector they both are worth integrating into your toolbox.

@brucejo thanks for an idea to debug this thing - I’ll check both tools out and see if I can’t get a bit more info to figure this out.

The email client recently broke my account creation, maybe resetPassword is sending email and the broken package is throwing an error. Check if meteor update updates the email package and fixes the error, if not disregard.

@fpaboim I had received the email update already - it did not fix my issue :frowning: but thanks for the suggestion.

@brucejo I was already using Toad to but I think I like RoboMongo better.

So I think I figured this out

I had a subscription on the reset page that was firing when the reset occurred the first time causing the view to to call reset again - it was this second attempt which was causing the problem.

Node inspector via meteor debug command helped with this.

Good to hear.

BTW: there is a console bug in node-inspector, you can check out a workaround here in issue #7991.