aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/validators/users.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-09-28 16:00:32 +0200
committerChocobozzz <me@florianbigard.com>2022-09-28 16:00:32 +0200
commitc5f3ff39e5351ac911418c432dac235c5aefec9e (patch)
tree5b7cbcf7a4436f891515364e735d564948a4503d /server/middlewares/validators/users.ts
parent1f545e80b4db2aa371be48e3bce7de8f32d557d3 (diff)
downloadPeerTube-c5f3ff39e5351ac911418c432dac235c5aefec9e.tar.gz
PeerTube-c5f3ff39e5351ac911418c432dac235c5aefec9e.tar.zst
PeerTube-c5f3ff39e5351ac911418c432dac235c5aefec9e.zip
Ask password reset/email verif error handling
With a user that uses a plugin authentication
Diffstat (limited to 'server/middlewares/validators/users.ts')
-rw-r--r--server/middlewares/validators/users.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/server/middlewares/validators/users.ts b/server/middlewares/validators/users.ts
index 2de5265fb..eb693318f 100644
--- a/server/middlewares/validators/users.ts
+++ b/server/middlewares/validators/users.ts
@@ -411,6 +411,13 @@ const usersAskResetPasswordValidator = [
411 return res.status(HttpStatusCode.NO_CONTENT_204).end() 411 return res.status(HttpStatusCode.NO_CONTENT_204).end()
412 } 412 }
413 413
414 if (res.locals.user.pluginAuth) {
415 return res.fail({
416 status: HttpStatusCode.CONFLICT_409,
417 message: 'Cannot recover password of a user that uses a plugin authentication.'
418 })
419 }
420
414 return next() 421 return next()
415 } 422 }
416] 423]
@@ -454,6 +461,13 @@ const usersAskSendVerifyEmailValidator = [
454 return res.status(HttpStatusCode.NO_CONTENT_204).end() 461 return res.status(HttpStatusCode.NO_CONTENT_204).end()
455 } 462 }
456 463
464 if (res.locals.user.pluginAuth) {
465 return res.fail({
466 status: HttpStatusCode.CONFLICT_409,
467 message: 'Cannot ask verification email of a user that uses a plugin authentication.'
468 })
469 }
470
457 return next() 471 return next()
458 } 472 }
459] 473]