aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-10-07 14:23:42 +0200
committerChocobozzz <me@florianbigard.com>2022-10-07 14:28:35 +0200
commit2166c058f34dff6f91566930d12448805d829de7 (patch)
tree2b9100b8eccbac287d1105c765901f966a354986 /server/controllers
parentd12b40fb96d56786a96c06a621f3d8e0a0d24f4a (diff)
downloadPeerTube-2166c058f34dff6f91566930d12448805d829de7.tar.gz
PeerTube-2166c058f34dff6f91566930d12448805d829de7.tar.zst
PeerTube-2166c058f34dff6f91566930d12448805d829de7.zip
Allow admins to disable two factor auth
Diffstat (limited to 'server/controllers')
-rw-r--r--server/controllers/api/users/two-factor.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/server/controllers/api/users/two-factor.ts b/server/controllers/api/users/two-factor.ts
index 1725294e7..79f63a62d 100644
--- a/server/controllers/api/users/two-factor.ts
+++ b/server/controllers/api/users/two-factor.ts
@@ -1,7 +1,7 @@
1import express from 'express' 1import express from 'express'
2import { generateOTPSecret, isOTPValid } from '@server/helpers/otp' 2import { generateOTPSecret, isOTPValid } from '@server/helpers/otp'
3import { Redis } from '@server/lib/redis' 3import { Redis } from '@server/lib/redis'
4import { asyncMiddleware, authenticate, usersCheckCurrentPassword } from '@server/middlewares' 4import { asyncMiddleware, authenticate, usersCheckCurrentPasswordFactory } from '@server/middlewares'
5import { 5import {
6 confirmTwoFactorValidator, 6 confirmTwoFactorValidator,
7 disableTwoFactorValidator, 7 disableTwoFactorValidator,
@@ -13,7 +13,7 @@ const twoFactorRouter = express.Router()
13 13
14twoFactorRouter.post('/:id/two-factor/request', 14twoFactorRouter.post('/:id/two-factor/request',
15 authenticate, 15 authenticate,
16 asyncMiddleware(usersCheckCurrentPassword), 16 asyncMiddleware(usersCheckCurrentPasswordFactory(req => req.params.id)),
17 asyncMiddleware(requestOrConfirmTwoFactorValidator), 17 asyncMiddleware(requestOrConfirmTwoFactorValidator),
18 asyncMiddleware(requestTwoFactor) 18 asyncMiddleware(requestTwoFactor)
19) 19)
@@ -27,7 +27,7 @@ twoFactorRouter.post('/:id/two-factor/confirm-request',
27 27
28twoFactorRouter.post('/:id/two-factor/disable', 28twoFactorRouter.post('/:id/two-factor/disable',
29 authenticate, 29 authenticate,
30 asyncMiddleware(usersCheckCurrentPassword), 30 asyncMiddleware(usersCheckCurrentPasswordFactory(req => req.params.id)),
31 asyncMiddleware(disableTwoFactorValidator), 31 asyncMiddleware(disableTwoFactorValidator),
32 asyncMiddleware(disableTwoFactor) 32 asyncMiddleware(disableTwoFactor)
33) 33)