adapt_authoring icon indicating copy to clipboard operation
adapt_authoring copied to clipboard

Install script shouldn't fail on incorrect password

Open taylortom opened this issue 6 years ago • 2 comments

Expected Behaviour

The script allows infinite attempts to retype the password, until the user exits the script.

Actual Behaviour

If the passwords don't match, the script logs an error and exits.

Steps to Reproduce

  1. Run install script
  2. Enter incorrect password when asked to Confirm Password

Versions

  • Authoring Tool Version: 0.4.0

taylortom avatar Jun 20 '18 10:06 taylortom

This might be a simple way to keep checking the password.

https://github.com/adaptlearning/adapt_authoring/blob/master/install.js#L483-L503

var comparePass = function(pass, retype) {
  if ( pass !== retype) {
    console.log('Passwords do not match, please try again.');
    installHelpers.getInput([inputData.superUser[1], inputData.superUser[2]], function(res) {
      comparePass(res.suPassword, res.suRetypePassword);
    }
  } else {
    app.usermanager.deleteUser({ email: result.suEmail }, function(error, userRec) {
      if(error) return onError(error);
      // add a new user using default auth plugin
      new localAuth().internalRegisterUser(true, {
        email: result.suEmail,
        password: pass,
        retypePassword: pass,
        _tenantId: masterTenant._id
      }, function(error, user) {
        if(error) {
          return onError(error);
        }
        superUser = user;
        helpers.grantSuperPermissions(user._id, function(error) {
          if(error) return onError(error);
          return callback();
        });
      });
    });
  }
}

console.log('');
comparePass(result.suPassword, result.suRetypePassword)

Link2Twenty avatar Jul 16 '19 12:07 Link2Twenty

@taylortom any news on this? Absolute nightmare when you mistype :(

simondate avatar Jun 11 '20 15:06 simondate