Compare commits

...

2 Commits

2 changed files with 8 additions and 5 deletions

View File

@ -51,7 +51,10 @@
validity_period: 20, validity_period: 20,
}, },
auth: { auth: {
approval_mode: false, // Registered accounts need to be approved by an administrator // If true, registered accounts need to be approved by an administrator
name_change_wait_period: 2592000000, // 30 days approval_mode: false,
// 30 days
name_change_wait_period: 2592000000,
}, },
} }

View File

@ -91,11 +91,11 @@ export default class AccountController extends Controller {
} }
protected async postChangePassword(req: Request, res: Response): Promise<void> { protected async postChangePassword(req: Request, res: Response): Promise<void> {
const validationMap = { await Validator.validate({
'new_password': new Validator().defined(), 'new_password': new Validator().defined(),
'new_password_confirmation': new Validator().sameAs('new_password', req.body.new_password), 'new_password_confirmation': new Validator().sameAs('new_password', req.body.new_password),
}; }, req.body);
await Validator.validate(validationMap, req.body);
const user = req.as(RequireAuthMiddleware).getUser(); const user = req.as(RequireAuthMiddleware).getUser();
const passwordComponent = user.as(UserPasswordComponent); const passwordComponent = user.as(UserPasswordComponent);
if (passwordComponent.hasPassword() && !await passwordComponent.verifyPassword(req.body.current_password)) { if (passwordComponent.hasPassword() && !await passwordComponent.verifyPassword(req.body.current_password)) {