1.1.1. Validator configuration

A configuration is created by adding an entry with the gatein.validators. prefix to the exo.properties file. This prefix is followed by a validator name, a period '.' and a validator aspect. Currently, there are the following validators and validator aspects:

See details about the "username" validator as below. For instructions on how to add a new validator (not in the above list), see Developing your own validator.

Configuration of username validator

By default, the username will be validated as follows:

Note

Some components that leverage GateIn depend on usernames being all lowercase. Therefore, you are strongly recommended to use a lowercase username only.

If you want to validate that username format is email-like, you could use the following configuration:

# validators
gatein.validators.username.regexp=^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$
gatein.validators.username.format.message=Username must be a valid email address

When the username field does not conform to this rule, the account is not created and there will be a warning message:

The field "User Name" must match the format "Username must be a valid email address".

In case you do not define gatein.validators.username.format.message, the value of gatein.validators.username.regexp will be used in the warning message:

The field "User Name" must match the format "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$".
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus