Clean validator in AccountController
This commit is contained in:
parent
caae753d74
commit
ec0dc30709
@ -91,11 +91,11 @@ export default class AccountController extends Controller {
|
||||
}
|
||||
|
||||
protected async postChangePassword(req: Request, res: Response): Promise<void> {
|
||||
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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user