Do not automatically generate the user's email for password verification

This commit is contained in:
Johannes Zellner
2018-01-22 16:12:13 +01:00
parent 8bcd807010
commit 591f01bb45
+3 -11
View File
@@ -247,19 +247,11 @@ function verifyWithEmail(email, password, callback) {
assert.strictEqual(typeof password, 'string');
assert.strictEqual(typeof callback, 'function');
email = email.toLowerCase();
mail.get(config.fqdn(), function (error, mailConfig) {
userdb.getByEmail(email.toLowerCase(), function (error, user) {
if (error && error.reason == DatabaseError.NOT_FOUND) return callback(new UserError(UserError.NOT_FOUND));
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
if (mailConfig.enabled) return verifyWithUsername(email.split('@')[0], password, callback);
userdb.getByEmail(email, function (error, user) {
if (error && error.reason == DatabaseError.NOT_FOUND) return callback(new UserError(UserError.NOT_FOUND));
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
verify(user.id, password, callback);
});
verify(user.id, password, callback);
});
}