From c5f3ff39e5351ac911418c432dac235c5aefec9e Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Sep 2022 16:00:32 +0200 Subject: Ask password reset/email verif error handling With a user that uses a plugin authentication --- server/middlewares/validators/users.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'server/middlewares/validators') 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 = [ return res.status(HttpStatusCode.NO_CONTENT_204).end() } + if (res.locals.user.pluginAuth) { + return res.fail({ + status: HttpStatusCode.CONFLICT_409, + message: 'Cannot recover password of a user that uses a plugin authentication.' + }) + } + return next() } ] @@ -454,6 +461,13 @@ const usersAskSendVerifyEmailValidator = [ return res.status(HttpStatusCode.NO_CONTENT_204).end() } + if (res.locals.user.pluginAuth) { + return res.fail({ + status: HttpStatusCode.CONFLICT_409, + message: 'Cannot ask verification email of a user that uses a plugin authentication.' + }) + } + return next() } ] -- cgit v1.2.3