diff --git a/src/auth/AccountController.ts b/src/auth/AccountController.ts index a3f7c15..ba3367e 100644 --- a/src/auth/AccountController.ts +++ b/src/auth/AccountController.ts @@ -91,11 +91,11 @@ export default class AccountController extends Controller { } protected async postChangePassword(req: Request, res: Response): Promise { - const validationMap = { + await Validator.validate({ 'new_password': new Validator().defined(), 'new_password_confirmation': new Validator().sameAs('new_password', req.body.new_password), - }; - await Validator.validate(validationMap, req.body); + }, req.body); + const user = req.as(RequireAuthMiddleware).getUser(); const passwordComponent = user.as(UserPasswordComponent); if (passwordComponent.hasPassword() && !await passwordComponent.verifyPassword(req.body.current_password)) {