fixed password retype field error display
This commit is contained in:
		
							parent
							
								
									34982a8ae4
								
							
						
					
					
						commit
						b5ce9d3269
					
				
					 1 changed files with 15 additions and 2 deletions
				
			
		|  | @ -117,7 +117,8 @@ public class UserAccountController extends ActivatableEntityController<UserInfo, | |||
|     @Override | ||||
|     protected Result<UserMod> validForCreate(final UserMod userInfo) { | ||||
|         return super.validForCreate(userInfo) | ||||
|                 .flatMap(this::additionalConsistencyChecks); | ||||
|                 .flatMap(this::additionalConsistencyChecks) | ||||
|                 .flatMap(this::passwordMatch); | ||||
|     } | ||||
| 
 | ||||
|     @Override | ||||
|  | @ -151,6 +152,18 @@ public class UserAccountController extends ActivatableEntityController<UserInfo, | |||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     private <T extends UserAccount> Result<UserMod> passwordMatch(final UserMod userInfo) { | ||||
|         if (!userInfo.newPasswordMatch()) { | ||||
|             throw new APIMessageException(APIMessage.fieldValidationError( | ||||
|                     new FieldError( | ||||
|                             "passwordChange", | ||||
|                             PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, | ||||
|                             "user:confirmNewPassword:password.mismatch"))); | ||||
|         } | ||||
| 
 | ||||
|         return Result.of(userInfo); | ||||
|     } | ||||
| 
 | ||||
|     /** Additional consistency checks that has to be checked before create and save actions */ | ||||
|     private <T extends UserAccount> Result<T> additionalConsistencyChecks(final T userInfo) { | ||||
|         return Result.tryCatch(() -> { | ||||
|  | @ -217,7 +230,7 @@ public class UserAccountController extends ActivatableEntityController<UserInfo, | |||
|                     new FieldError( | ||||
|                             "passwordChange", | ||||
|                             PasswordChange.ATTR_NAME_CONFIRM_NEW_PASSWORD, | ||||
|                             "user:retypedNewPassword:password.mismatch"))); | ||||
|                             "user:confirmNewPassword:password.mismatch"))); | ||||
|         } | ||||
| 
 | ||||
|         return info; | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 anhefti
						anhefti