Screen Name Validator

The Screen Name Validator sample provides a way to validate a user’s inputted screen name. During validation, the screen name is tested client-side and server-side.

This sample checks if a user’s screen name contains reserved words that are configured in the Control PanelConfigurationSystem SettingsFoundationScreenName Validator menu. The default values for the screen name validator’s reserved words are admin and user.

Figure 1: Enter reserved words for the screen name validator.

Figure 1: Enter reserved words for the screen name validator.

You can test this sample by following the following steps:

  1. Deploy the Screen Name Validator to your portal installation.
  2. Navigate to the Control PanelUsersUsers and Organizations menu.
  3. Create a new user by selecting the Add User (Add User) button.
  4. Adding a screen name that contains the word admin or user.

Figure 2: The error message displays when inputting a reserved word for the screen name.

Figure 2: The error message displays when inputting a reserved word for the screen name.

What API(s) and/or code components does this sample highlight?

This sample leverages the ScreenNameValidator API.

How does this sample leverage the API(s) and/or code component?

To customize this sample, modify its com.liferay.blade.samples.screenname.validator.internal.CustomScreenNameValidator class.

You can also customize this sample’s configuration by adding more properties in its com.liferay.blade.samples.screenname.validator.CustomScreenNameConfiguration class.

For more information on customizing the Validation sample to fit your needs, see the Javadoc provided in this sample’s Java classes.

Where Is This Sample?

There are three different versions of this sample, each built with a different build tool:

« Model ListenerServlet »
Was this article helpful?
0 out of 0 found this helpful