Add fallbackEmail to user data model
This commit is contained in:
@@ -166,6 +166,7 @@ function createUser(username, password, email, displayName, auditSource, options
|
||||
id: 'uid-' + uuid.v4(),
|
||||
username: username,
|
||||
email: email,
|
||||
fallbackEmail: email, // for new users the fallbackEmail is also the default email
|
||||
password: new Buffer(derivedKey, 'binary').toString('hex'),
|
||||
salt: salt.toString('hex'),
|
||||
createdAt: now,
|
||||
@@ -399,6 +400,12 @@ function updateUser(userId, data, auditSource, callback) {
|
||||
if (error) return callback(error);
|
||||
}
|
||||
|
||||
if (data.fallbackEmail) {
|
||||
data.fallbackEmail = data.fallbackEmail.toLowerCase();
|
||||
error = validateEmail(data.fallbackEmail);
|
||||
if (error) return callback(error);
|
||||
}
|
||||
|
||||
userdb.get(userId, function (error) {
|
||||
if (error && error.reason === DatabaseError.NOT_FOUND) return callback(new UserError(UserError.NOT_FOUND));
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
|
||||
Reference in New Issue
Block a user