users: add route to disable 2fa
This commit is contained in:
@@ -15,6 +15,8 @@ exports = module.exports = {
|
||||
clearAvatar,
|
||||
makeOwner,
|
||||
|
||||
disableTwoFactorAuthentication,
|
||||
|
||||
load
|
||||
};
|
||||
|
||||
@@ -156,6 +158,18 @@ function createInvite(req, res, next) {
|
||||
});
|
||||
}
|
||||
|
||||
function disableTwoFactorAuthentication(req, res, next) {
|
||||
assert.strictEqual(typeof req.resource, 'object');
|
||||
|
||||
if (users.compareRoles(req.user.role, req.resource.role) < 0) return next(new HttpError(403, `role '${req.resource.role}' is required but user has only '${req.user.role}'`));
|
||||
|
||||
users.disableTwoFactorAuthentication(req.resource.id, function (error, result) {
|
||||
if (error) return next(BoxError.toHttpError(error));
|
||||
|
||||
next(new HttpSuccess(200, result));
|
||||
});
|
||||
}
|
||||
|
||||
function sendInvite(req, res, next) {
|
||||
assert.strictEqual(typeof req.resource, 'object');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user