def verify_length_and_trunc_password(password):
 max_length = CONF.identity.max_password_length
 try:
  if (len(password) > max_length):
   if CONF.strict_password_check:
    raise exception.PasswordVerificationError(size=max_length)
   else:
    msg = _LW('Truncating user password to %d characters.')
    LOG.warning(msg, max_length)
    return password[:max_length]
  else:
   return password
 except TypeError:
  raise exception.ValidationError(attribute='string', target='password')

def verify_length_and_trunc_password ( password ) : max_length = CONF . identity . max_password_length try : if ( len ( password ) > max_length ) : if CONF . strict_password_check : raise exception . PasswordVerificationError ( size = max_length ) else : msg = _LW ( 'Truncating user password to %d characters.' ) LOG . warning ( msg , max_length ) return password [ : max_length ] else : return password except TypeError : raise exception . ValidationError ( attribute = 'string' , target = 'password' )
verify and truncate the provided password to the max_password_length .