User error when changing the password

Good night, I’m using a custom database and I configure the script to change the password, I try it and it works perfect, but when I send the mail to the user to change the password, I see that when I do the submit, it changes the password in the database on mongo, but in the browser tells you that there was an error


Hi @jorge,

Can you post your script here for verifications.

Yes that would be helpful for us!

function changePassword(email, newPassword, callback) {
  const bcrypt = require('bcrypt');
  const MongoClient = require('mongodb@3.1.4').MongoClient;
  const dbUser = configuration.dbUser;
  const dbPwd = configuration.dbPwd;
  const dbHost = configuration.dbHost;
  const dbName = configuration.dbName;
  const usersCollection = configuration.usersCollection;
  const uri = `mongodb+srv://${dbUser}:${dbPwd}@${dbHost}/test?retryWrites=true`;
  const client = new MongoClient(uri, { useNewUrlParser: true });

  client.connect(function (err) {
    if (err) return callback(err);

    const db = client.db(dbName);
    const users = db.collection(usersCollection);

    bcrypt.hash(newPassword, 10, function (err, hash) {
      if (err) {
        return callback(err);

      users.update({ email: email }, { $set: { password: hash } }, function (err, count) {
        if (err) return callback(err);
        callback(null, count > 0);

Please confirm, this javascript function you calling in password Reset window? If yes then please post your all password reset window code. We need to complete the flow which i believe is missing somehow.