Filter disabled/inactive users out

This commit is contained in:
Bryan Ashby 2023-01-01 20:54:19 -07:00
parent 2b958e0885
commit ff219cbb06
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
1 changed files with 12 additions and 1 deletions

View File

@ -1,6 +1,6 @@
const WebHandlerModule = require('../../../web_handler_module');
const Config = require('../../../config').get;
const { Errors } = require('../../../enig_error');
const { Errors, ErrorReasons } = require('../../../enig_error');
const WebServerPackageName = require('../web').moduleInfo.packageName;
const { WellKnownLocations } = require('../web');
@ -294,6 +294,17 @@ Achievement Points: %ACHIEVEMENT_POINTS%`,
return cb(err);
}
const accountStatus = user.getPropertyAsNumber(UserProps.AccountStatus);
if (
User.AccountStatus.disabled == accountStatus &&
User.AccountStatus.inactive == accountStatus
) {
this._notFound(resp);
return cb(
Errors.AccessDenied('Account disabled', ErrorReasons.Disabled)
);
}
return cb(null, user);
});
});