Adjust api to set a flag if invitiation should be sent on user creation
This commit is contained in:
@@ -113,12 +113,13 @@ function validateToken(token) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function createUser(username, password, email, admin, invitor, callback) {
|
||||
function createUser(username, password, email, admin, invitor, sendInvite, callback) {
|
||||
assert.strictEqual(typeof username, 'string');
|
||||
assert.strictEqual(typeof password, 'string');
|
||||
assert.strictEqual(typeof email, 'string');
|
||||
assert.strictEqual(typeof admin, 'boolean');
|
||||
assert(invitor || admin);
|
||||
assert.strictEqual(typeof sendInvite, 'boolean');
|
||||
assert.strictEqual(typeof callback, 'function');
|
||||
|
||||
var error = validateUsername(username);
|
||||
@@ -157,7 +158,7 @@ function createUser(username, password, email, admin, invitor, callback) {
|
||||
|
||||
// only send welcome mail if user is not an admin. This is only the case for the first user!
|
||||
// The welcome email contains a link to create a new password
|
||||
if (!user.admin) mailer.userAdded(user, invitor);
|
||||
if (sendInvite) mailer.userAdded(user, invitor);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -389,7 +390,7 @@ function createOwner(username, password, email, callback) {
|
||||
if (error) return callback(new UserError(UserError.INTERNAL_ERROR, error));
|
||||
if (count !== 0) return callback(new UserError(UserError.ALREADY_EXISTS));
|
||||
|
||||
createUser(username, password, email, true /* admin */, null /* invitor */, callback);
|
||||
createUser(username, password, email, true /* admin */, null /* invitor */, false /* sendInvite */, callback);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user