/** * Add a violation to the underlying list. * * @param key the bundle/localization key for the message. */ public void addViolation( String key ) { addViolation(key, null); }
public void testPassword( PasswordRuleViolations violations, User user ) { if ( minimumCharacters > maximumCharacters ) { /* this should caught up front during the configuration of the component */ // TODO: Throw runtime exception instead? violations.addViolation( CHARACTER_LENGTH_MISCONFIGURED_VIOLATION, new Object[]{ String.valueOf( minimumCharacters ), String.valueOf( maximumCharacters )} ); //$NON-NLS-1$ } String password = user.getPassword(); if ( StringUtils.isEmpty( password ) || password.length() < minimumCharacters || password.length() > maximumCharacters ) { violations.addViolation( CHARACTER_LENGTH_VIOLATION, new Object[]{String.valueOf( minimumCharacters ), String.valueOf( maximumCharacters )} ); //$NON-NLS-1$ } }
public void testPassword( PasswordRuleViolations violations, User user ) { char[] password = user.getPassword().toCharArray(); for ( int i = 0; i < password.length; i++ ) { if ( !Character.isLetterOrDigit( password[i] ) ) { violations.addViolation( ALPHANUM_VIOLATION ); return; } } }
public void testPassword( PasswordRuleViolations violations, User user ) { if ( StringUtils.isEmpty( user.getPassword() ) ) { violations.addViolation( MISSING_PASSWORD_VIOLATION ); //$NON-NLS-1$ } }
public void testPassword( PasswordRuleViolations violations, User user ) { char[] password = user.getPassword().toCharArray(); for ( int i = 0; i < password.length; i++ ) { if ( Character.isWhitespace( password[i] ) ) { violations.addViolation( NO_WHITE_SPACE_VIOLATION ); return; } } }
public void testPassword( PasswordRuleViolations violations, User user ) { if ( countAlphaCharacters( user.getPassword() ) < this.minimumCount ) { violations.addViolation( ALPHA_COUNT_VIOLATION, new Object[]{String.valueOf( minimumCount )} ); //$NON-NLS-1$ } }
public void testPassword( PasswordRuleViolations violations, User user ) { if ( countDigitCharacters( user.getPassword() ) < this.minimumCount ) { violations.addViolation( NUMERICAL_COUNT_VIOLATION, new Object[]{String.valueOf( minimumCount )} ); //$NON-NLS-1$ } }
public void testPassword( PasswordRuleViolations violations, User user ) { String password = user.getPassword(); if ( hasReusedPassword( user, password ) ) { violations.addViolation( REUSE_VIOLATION, new Object[]{String.valueOf( getPreviousPasswordCount() )} ); //$NON-NLS-1$ } }