Class InputPassword

All Implemented Interfaces:
Serializable, overit.geocall.marks.MethodExposer, overit.geocall.marks.NameExposer, Arrangeable, Badgeable, ValueValidator, Identified, Tool, overit.geocall.ux.configurability.UIConfigurable, overit.geocall.ux.edm.ModelConfigurable

@Component @Configurable @Ignore("FILTER_CRITERION") public class InputPassword extends Input implements Arrangeable
This class implements an input field that hides the characters while the user types in his password.
This input offers additional potential for validation; in fact, it is possible to insert in the configuration file some rules (minimum length, presence of particular characters, different value against the username, and other constraints) which will be validated during the form submission.
It is also possible to create a couple of InputPassword fields to force the user to reinsert the password, avoiding possbile typing errors and verifying the password consistency
See Also:
GCApi:
component
  • Field Details

    • _cryptalgoritm

      protected String _cryptalgoritm
    • _passwordAlgoritm

      protected String _passwordAlgoritm
    • _userFieldRegistry

      protected String _userFieldRegistry
    • _verify

      protected String _verify
    • _msgPasswordNonCoincidono

      protected String _msgPasswordNonCoincidono
    • _msgInserireAlmeno

      protected String _msgInserireAlmeno
    • _validation

      protected Boolean _validation
    • _hadContent

      protected boolean _hadContent
    • validationMode

      protected InputPassword.ValidationMode validationMode
  • Constructor Details

    • InputPassword

      public InputPassword()
      Creates an InputPassword
  • Method Details

    • buildDisplayScript

      public void buildDisplayScript(StringBuilder sb)
      Every component can add a script to the StringBuilder, script executed when the component is displayed. The method add the script that manage the password verification field
      Overrides:
      buildDisplayScript in class Input
      Parameters:
      sb - The StringBuilder on which we want to add the script
    • setPASSWORDALGORITHM

      public void setPASSWORDALGORITHM(String passwordAlgorithm)
      Sets forcibly, for this specific password field, the algorithm used to crypt te password. The hashing is done during the submit phase either from the client, or from the server depending on the configuration of the web context. If not defined, the algorithm will be readed from the configuration file
      Parameters:
      passwordAlgorithm - The string that defines one of the cryptation algorithm. Possible values are:
      HEX_MD5, B64_MD5, HEX_SHA1, B64_SHA1, HEX_SHA256, B64_SHA256, HEX_SHA512, B64_SHA512
    • setVALIDATION

      public void setVALIDATION(String s)
      Defines if the field verifies that the password value respects the password constraints defined in the configuration's file
      Parameters:
      s - A string that represents a boolean value ("true" or "1", "false" or "0").
      If the string is not recognized as a boolean value, it will be used the default value, that is true
    • setUSERFIELDREGISTRY

      public void setUSERFIELDREGISTRY(String s)
      Sets the string containing the reference at the name of the username field. If specified, the hashing is done considering the password and the username values, otherwise the hashing is limited to the password's value. By activating this mode, safety is improved and possible attempts to force the password are more difficult, longer and complex.
      Parameters:
      s - The string containing the reference at the name of the username field
    • setVERIFY

      public void setVERIFY(String s)
      Sets the string containing the name of the InputPassword whose value must matches in order to pass the validation. This attribute allows a second InputPassword to be used as a verification field in order to force the user to reinsert the password, avoiding possible typing errors
      Parameters:
      s - The name of the InputPassword used to verify the password consistency
    • setVALIDATIONMODE

      public void setVALIDATIONMODE(String s)
      Sets the string containing the validation mode of the InputPassword. Possible value are: form or identity If the validation mode is form then the values inside the form will be used to validate the password of the user. If the validation mode is identity then the values of the currently logged-in user will be used to validate the password. identity is the default option.
      Parameters:
      s - The string containing the validation mode. Possible value are: form or identity.
    • setup

      protected void setup()
      Description copied from class: Component
      Setup the Component
      Overrides:
      setup in class Input
    • validate

      protected void validate(org.apache.ecs.html.Input i, EntitySet es, boolean ro)
      Overrides:
      validate in class Input
    • buildSetupScript

      public void buildSetupScript(StringBuilder sb)
      Description copied from class: Component
      Every component can add a script to the StringBuilder, script executed when the component is created.
      Overrides:
      buildSetupScript in class Component
      Parameters:
      sb - The StringBuilder on which we want to add the script
    • prepareValue

      protected String prepareValue()
      Overrides:
      prepareValue in class Input
    • prepareValue

      protected String prepareValue(String name, String def)
    • prepareDAValue

      protected String prepareDAValue()
    • getContentHtml

      public org.apache.ecs.Element getContentHtml(Object generationhandle, EntitySet es)
      Description copied from class: Input
      Implements the interface Arrangeable. It returns the html code that represents the active part of the input field, i.e. the field and the validation scripts
      Specified by:
      getContentHtml in interface Arrangeable
      Overrides:
      getContentHtml in class Input
      Parameters:
      generationhandle - The handle of the generation
      es - The EntitySet to which the element belongs
      Returns:
      The html code of the input field or null if the field don't have a graphical representation
    • addAttributes

      protected void addAttributes(org.apache.ecs.html.Input i)
    • hadContent

      protected boolean hadContent()
    • getDescriptionHtml

      public org.apache.ecs.Element getDescriptionHtml(Object generationhandle, EntitySet es)
      Description copied from class: Input
      Implements the interface Arrangeable. It returns the html code that represents the component description i.e. the formatted label of the field
      Specified by:
      getDescriptionHtml in interface Arrangeable
      Overrides:
      getDescriptionHtml in class Input
      Parameters:
      generationhandle - The handle of the generation
      es - The EntitySet to which the element belongs
      Returns:
      The html code of the label, or null if the field don't have it or is hidden
    • getHiddenHtml

      public org.apache.ecs.Element getHiddenHtml(Object generationhandle, EntitySet es)
      Description copied from class: Input
      Implements the interface Arrangeable. It returns the hidden but active html part of an hidden input field.
      Specified by:
      getHiddenHtml in interface Arrangeable
      Overrides:
      getHiddenHtml in class Input
      Parameters:
      generationhandle - The handle of the generation
      es - The EntitySet to which the element belongs
      Returns:
      The html code of the hidden part of the field or null if the field is visible.
    • getGenerationHandle

      public Object getGenerationHandle()
      Description copied from class: Input
      Implements the interface Arrangeable
      Specified by:
      getGenerationHandle in interface Arrangeable
      Overrides:
      getGenerationHandle in class Input
      Returns:
      null
    • getHtml

      public org.apache.ecs.Element getHtml(EntitySet es)
      Description copied from class: Input
      Returns the html of the Input element
      Overrides:
      getHtml in class Input
      Parameters:
      es - The EntitySet
      Returns:
      The html of the Input element
    • getRegExList

      public static String getRegExList(Identity identity, List<String> constraintIds, Teacher t)
      Return a string containing the list of regular expressions
      Parameters:
      identity - The identity
      constraintIds - list of the password constraints ids
      t - Object used to translate
      Returns:
      A string containing the list of regular expressions
    • getRegExList

      public static String getRegExList(HashGetter hg, List<String> constraintIds, Teacher t)
      Return a string containing the list of regular expressions
      Parameters:
      hg - The HashGetter containing the identity information
      constraintIds - list of the password constraints ids
      t - Object used to translate
      Returns:
      A string containing the list of regular expressions
    • getPasswordValidationAttribute

      public static HashGetter getPasswordValidationAttribute(Identity identity, boolean validation, String minlength, String maxlength)
      Returns the password validation attributes
      Parameters:
      identity - The identity
      validation - Boolean value that defines if the field verifies that the password value respects the password constraints defined in the configuration's file
      minlength - of the password
      maxlength - of the password
      Returns:
      An HashGetter with the validation attributes
    • validateUnchangingValue

      protected void validateUnchangingValue(String name, Object value, Object published, boolean strong, Map arriving) throws ValidationException
      Overrides:
      validateUnchangingValue in class Input
      Throws:
      ValidationException
    • validateNotNull

      protected void validateNotNull(String name, Object value, boolean strong, Map arriving) throws ValidationException
      Overrides:
      validateNotNull in class Input
      Throws:
      ValidationException