never skip password verification

This commit is contained in:
Girish Ramakrishnan
2019-11-07 13:06:31 -08:00
parent ab650c7a95
commit 5c920fd200
4 changed files with 11 additions and 14 deletions

View File

@@ -201,13 +201,15 @@ function sync(progressCallback, callback) {
// we ignore all errors here and just log them for now
async.eachSeries(ldapUsers, function (user, iteratorCallback) {
const delayedCallback = (error) => setTimeout(iteratorCallback, 40000);
const username = user[externalLdapConfig.usernameField];
const email = user.mail;
const displayName = user.cn; // user.giveName + ' ' + user.sn
if (!username || !email || !displayName) {
debug(`[empty username/email/displayName] username=${username} email=${email} displayName=${displayName} usernameField=${externalLdapConfig.usernameField}`);
return iteratorCallback();
return delayedCallback();
}
percent += step;
@@ -216,7 +218,7 @@ function sync(progressCallback, callback) {
users.getByUsername(username, function (error, result) {
if (error && error.reason !== BoxError.NOT_FOUND) {
debug(`Could not find user with username ${username}: ${error.message}`);
return iteratorCallback();
return delayedCallback();
}
if (error) {
@@ -224,25 +226,25 @@ function sync(progressCallback, callback) {
users.create(username, null /* password */, email, displayName, { source: 'ldap' }, auditSource.EXTERNAL_LDAP_TASK, function (error) {
if (error) console.error('Failed to create user', user, error);
iteratorCallback();
delayedCallback();
});
} else if (result.source !== 'ldap') {
debug(`[conflicting user] username=${username} email=${email} displayName=${displayName}`);
iteratorCallback();
delayedCallback();
} else if (result.email !== email || result.displayName !== displayName) {
debug(`[updating user] username=${username} email=${email} displayName=${displayName}`);
users.update(result.id, { email: email, fallbackEmail: email, displayName: displayName }, auditSource.EXTERNAL_LDAP_TASK, function (error) {
if (error) debug('Failed to update user', user, error);
iteratorCallback();
delayedCallback();
});
} else {
// user known and up-to-date
debug(`[up-to-date user] username=${username} email=${email} displayName=${displayName}`);
iteratorCallback();
delayedCallback();
}
});
}, function (error) {