feature: User Lockout (#4749)
* Allows masterKey to lock _User object and prevent login with email / password * Ensure the authData based auth can be locked out as well when accounts is masterKey only
This commit is contained in:
@@ -282,7 +282,9 @@ RestWrite.prototype.findUsersWithAuthData = function(authData) {
|
||||
RestWrite.prototype.handleAuthData = function(authData) {
|
||||
let results;
|
||||
return this.findUsersWithAuthData(authData).then((r) => {
|
||||
results = r;
|
||||
results = r.filter((user) => {
|
||||
return !this.auth.isMaster && user.ACL && Object.keys(user.ACL).length > 0;
|
||||
});
|
||||
if (results.length > 1) {
|
||||
// More than 1 user with the passed id's
|
||||
throw new Parse.Error(Parse.Error.ACCOUNT_ALREADY_LINKED,
|
||||
@@ -980,7 +982,7 @@ RestWrite.prototype.runDatabaseOperation = function() {
|
||||
if (this.query) {
|
||||
// Force the user to not lockout
|
||||
// Matched with parse.com
|
||||
if (this.className === '_User' && this.data.ACL) {
|
||||
if (this.className === '_User' && this.data.ACL && this.auth.isMaster !== true) {
|
||||
this.data.ACL[this.query.objectId] = { read: true, write: true };
|
||||
}
|
||||
// update password timestamp if user password is being changed
|
||||
|
||||
Reference in New Issue
Block a user