RE: @ in screenname

SZ khan, modified 14 Years ago. Regular Member Posts: 145 Join Date: 10/31/09 Recent Posts
I have a requirement that users will have screennames which may be may not be their email addresses. This means screenName could be either testusername or testusername@test.com.

As I see, It is not possible to insert a @ sign in the screenName. I have also configured to use

users.screen.name.validator=com.liferay.portal.security.auth.LiberalScreenNameValidator


The problem seems to be the following code in class UserLocalServiceImpl

for (char c : screenName.toCharArray()) {
                  if ((!Validator.isChar(c)) && (!Validator.isDigit(c)) &&
                        (c != CharPool.DASH) && (c != CharPool.PERIOD) &&
                        (c != CharPool.UNDERLINE)) {

                        throw new UserScreenNameException();
                  }
            }


How can I bypass it?

Are there any other options available?

Thanks,

Sultee
thumbnail
Jignesh Vachhani, modified 14 Years ago. Liferay Master Posts: 803 Join Date: 3/10/08 Recent Posts
I think you need to override validator class and you can bypass this @ validation.
or else you can override UserLocalServiceImpl class and bypass to calling validator class but this is not good practice.
SZ khan, modified 14 Years ago. Regular Member Posts: 145 Join Date: 10/31/09 Recent Posts
I created my custom validator but the concerned code comes after the validator class has done its job.
Siby Mathew, modified 14 Years ago. Expert Posts: 268 Join Date: 3/4/11 Recent Posts
Hi.. I am also facing the same problem... In my case I need to allow space in my screenName.
Even if we specify the LiberalScreenNameValidator class, the remaining code is throwing the exception.
@Jignesh How can we override the validator class in a plugin portlet environment ?