1
votes

I have a user who forgot their password. Using the Accounts package the user tried to get their password reset with the "Reset password" function. When they enter their email address it states "User Not Found".

What is causing this? More importantly how do I fix it? I've been beating my head into a wall trying to find a solution so any help would be great. I've tried to duplicate but my test accounts don't have the same issue.

My build is Meteor 1.2 with the accounts-password and accounts-base packages. My setup is:

passwordSignupFields: "USERNAME_AND_EMAIL"
1
Does the user exist? Could it be a case sensitivity issue? - MasterAM

1 Answers

1
votes

When resetting the user's password, Meteor tries to look up the user by the provided e-mail. If it cannot find the user using the e-mail - it throws the "User not found" - link to code here

Meteor.methods({forgotPassword: function (options) {
  check(options, {email: String});

  var user = Accounts.findUserByEmail(options.email);
  if (!user)
    throw new Meteor.Error(403, "User not found");

  const emails = _.pluck(user.emails || [], 'address');
  const caseSensitiveEmail = _.find(emails, email => {
    return email.toLowerCase() === options.email.toLowerCase();
  });

  Accounts.sendResetPasswordEmail(user._id, caseSensitiveEmail);
}});

Is the user providing the correct e-mail? Check that the e-mail being provided actually exists in the DB in the Meteor.users collection