diff options
author | Chocobozzz <me@florianbigard.com> | 2022-10-07 14:23:42 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-10-07 14:28:35 +0200 |
commit | 2166c058f34dff6f91566930d12448805d829de7 (patch) | |
tree | 2b9100b8eccbac287d1105c765901f966a354986 /server/controllers/api/users/two-factor.ts | |
parent | d12b40fb96d56786a96c06a621f3d8e0a0d24f4a (diff) | |
download | PeerTube-2166c058f34dff6f91566930d12448805d829de7.tar.gz PeerTube-2166c058f34dff6f91566930d12448805d829de7.tar.zst PeerTube-2166c058f34dff6f91566930d12448805d829de7.zip |
Allow admins to disable two factor auth
Diffstat (limited to 'server/controllers/api/users/two-factor.ts')
-rw-r--r-- | server/controllers/api/users/two-factor.ts | 6 |
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 @@ | |||
1 | import express from 'express' | 1 | import express from 'express' |
2 | import { generateOTPSecret, isOTPValid } from '@server/helpers/otp' | 2 | import { generateOTPSecret, isOTPValid } from '@server/helpers/otp' |
3 | import { Redis } from '@server/lib/redis' | 3 | import { Redis } from '@server/lib/redis' |
4 | import { asyncMiddleware, authenticate, usersCheckCurrentPassword } from '@server/middlewares' | 4 | import { asyncMiddleware, authenticate, usersCheckCurrentPasswordFactory } from '@server/middlewares' |
5 | import { | 5 | import { |
6 | confirmTwoFactorValidator, | 6 | confirmTwoFactorValidator, |
7 | disableTwoFactorValidator, | 7 | disableTwoFactorValidator, |
@@ -13,7 +13,7 @@ const twoFactorRouter = express.Router() | |||
13 | 13 | ||
14 | twoFactorRouter.post('/:id/two-factor/request', | 14 | twoFactorRouter.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 | ||
28 | twoFactorRouter.post('/:id/two-factor/disable', | 28 | twoFactorRouter.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 | ) |