enhance user creation API to take a password

This commit is contained in:
Girish Ramakrishnan
2018-04-26 13:58:21 -07:00
parent 7756c07bc6
commit 7549b3e837
3 changed files with 61 additions and 3 deletions
+2 -1
View File
@@ -34,8 +34,9 @@ function create(req, res, next) {
if (typeof req.body.invite !== 'boolean') return next(new HttpError(400, 'invite must be boolean'));
if ('username' in req.body && typeof req.body.username !== 'string') return next(new HttpError(400, 'username must be string'));
if ('displayName' in req.body && typeof req.body.displayName !== 'string') return next(new HttpError(400, 'displayName must be string'));
if ('password' in req.body && typeof req.body.password !== 'string') return next(new HttpError(400, 'password must be string'));
var password = generatePassword();
var password = req.body.password || generatePassword();
var email = req.body.email;
var sendInvite = req.body.invite;
var username = 'username' in req.body ? req.body.username : null;