protected boolean handleValidationErrors(ValidationErrors errors) { postValidate(errors); if (errors.isEmpty()) return true; ScreenValidation screenValidation = getBeanLocator().get(ScreenValidation.class); screenValidation.showValidationErrors(this, errors); return false; }
@Override protected void postValidate(ValidationErrors errors) { super.postValidate(errors); if (fileUpload.getFileId() == null) { errors.add(getMessage("reportException.noFile")); return; } String extension = FilenameUtils.getExtension(fileUpload.getFileName()); if (!StringUtils.equalsIgnoreCase(extension, ExportFormat.ZIP.getFileExt())) { errors.add(formatMessage("reportException.wrongFileType", extension)); } } }
@Override protected void postValidate(ValidationErrors errors) { super.postValidate(errors); String password = passwField.getValue(); if (errors.isEmpty()) { String currentPassword = currentPasswordField.getValue(); String passwordConfirmation = confirmPasswField.getValue(); UUID targetUserId; if (user == null) { targetUserId = userSession.getUser().getId(); } else { targetUserId = user.getId(); } if (currentPasswordRequired && !userManagementService.checkPassword(targetUserId, currentPassword)) { errors.add(currentPasswordField, getMessage("wrongCurrentPassword")); } else if (userManagementService.checkPassword(targetUserId, password)) { errors.add(passwField, getMessage("currentPasswordWarning")); } else if (!Objects.equals(password, passwordConfirmation)) { errors.add(confirmPasswField, getMessage("passwordsDoNotMatch")); } else { if (clientConfig.getPasswordPolicyEnabled()) { String regExp = clientConfig.getPasswordPolicyRegExp(); if (!password.matches(regExp)) { errors.add(passwField, getMessage("simplePassword")); } } } } }