Do not create user if username or password is empty (#3650)

This commit is contained in:
Wissam Abirached
2017-03-17 18:57:21 -04:00
committed by Florent Vilmart
parent ea94ae73f6
commit 2533a8cdb3
2 changed files with 26 additions and 2 deletions

View File

@@ -204,11 +204,11 @@ RestWrite.prototype.validateAuthData = function() {
}
if (!this.query && !this.data.authData) {
if (typeof this.data.username !== 'string') {
if (typeof this.data.username !== 'string' || _.isEmpty(this.data.username)) {
throw new Parse.Error(Parse.Error.USERNAME_MISSING,
'bad or missing username');
}
if (typeof this.data.password !== 'string') {
if (typeof this.data.password !== 'string' || _.isEmpty(this.data.password)) {
throw new Parse.Error(Parse.Error.PASSWORD_MISSING,
'password is required');
}