Foros de discusión

screen name can not have _ / character or email format

billy chan, modificado hace 16 años.

screen name can not have _ / character or email format

Junior Member Mensajes: 43 Fecha de incorporación: 19/11/07 Mensajes recientes
Hello,
when i import some user accounts, once his screen name have _ / character or his screen name is email address, the liferay will throw exception, and stop import process. Now, i only know one solution is changing the source code "ScreenNameValidator".

Question 1: Why screen name can not have character / _ or can not be email?

Question 2: If i need to use screen name to have these characters, How can i do it if i don't want to changing source code?

Question 3: Will i get any problem , if i changing the "ScreenNameValidator"?

Thanks
thumbnail
Alex Wallace, modificado hace 16 años.

RE: screen name can not have _ / character or email format

Liferay Master Mensajes: 640 Fecha de incorporación: 5/11/07 Mensajes recientes
you can write your own screen name validator and specify it in portal-ext.properties:



  #
  # Input a class name that extends
  # com.liferay.portal.security.auth.ScreenNameValidator. This class will be
  # called to validate user ids.
  #
  users.screen.name.validator=com.yourcompany.util.ScreenNameValidator
  #users.screen.name.validator=com.liferay.portal.security.auth.LiberalScreenNameValidator


At one point I talked about this with some liferay folks and they all agreed that it would be safe to allow _ in screen names...

you could use the already existing


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


The original reason, according to liferay, was due to some backwards compatibility with a legacy naming convension in an ancient unix system...
thumbnail
Roman Hoyenko, modificado hace 16 años.

RE: screen name can not have _ / character or email format

Liferay Master Mensajes: 878 Fecha de incorporación: 8/10/07 Mensajes recientes
It is easy to do and should not cost you any problems. Here is my custom validator, for example:

package xxxxx.api.util;

import com.liferay.portal.util.UserIdValidator;

import com.liferay.portal.model.User;
import com.liferay.util.Validator;

public class MyCustomValidator extends UserIdValidator
{
	public boolean validate(String userId, String companyId) {
		if (Validator.isNull(userId) ||
				(userId.equalsIgnoreCase("cyrus")) ||
				(userId.equalsIgnoreCase("postfix")) ||
				(userId.length() < 6 ) ||
				(userId.indexOf(User.DEFAULT) != -1)) 
		{

				return false;
			}
			else {
				return true;
			}
		
	}
	
}



I don't know why cyrus or postfix are not allowed, but I left it there just in case. And I made it to be at least 6 chars long. I don't see why email couldn't be the ID, so I removed this check as well as the check for undescore.
thumbnail
Renee Talabucon, modificado hace 13 años.

RE: screen name can not have _ / character or email format

Junior Member Mensajes: 31 Fecha de incorporación: 29/03/10 Mensajes recientes
Hi!~ Total Liferay newbie here..

I need something similar to this, I think.

Our Liferay login is set to screen name and what I need is to let the screen name start with a capital letter. Liferay saves the screen name to all small letters, regardless if you enter capital letters. (screen names are saved in database table "user_" , column name "screenname")

Anyone have an idea how I can force Liferay to allow screen names starting with a capital letter? emoticon Thanks for your help!~
thumbnail
Udaya Ramakrishnan, modificado hace 12 años.

RE: screen name can not have _ / character or email format

Junior Member Mensajes: 67 Fecha de incorporación: 7/09/11 Mensajes recientes
hi
i am very new to Liferay. i am having a similar requirement. i need to allow white spaces in screen name.
i understand and tried ur code. but it is showing error in console. i created hooks and done everything.
can u tell me the procedure in doing that

thank u

regards
Udaya.R
Andromeda K, modificado hace 11 años.

RE: screen name can not have _ / character or email format

New Member Mensajes: 2 Fecha de incorporación: 21/09/12 Mensajes recientes
Hello Guys,

I'm trying to change screenname validator in a way that it accepts @ character.

So it works if I add the user from the user interface while it doesn't work if I use the method add-user provided by json webservice.

I don't understand how you could change the behavior: http://www.liferay.com/community/wiki/-/wiki/Main/Liferay+Users+and+Screennames#2

If you see the above link after that you validate liferay continues to do the same checks so it's not possible without changing the souce code change the behavior for validationscreenName method in UserServiceLocalImpl or what should I do?

It throws an exception on UserServiceLocalImpl class
Caused by: com.liferay.portal.UserScreenNameException
at com.liferay.portal.service.impl.UserLocalServiceImpl.validateScreenName(UserLocalServiceImpl.java:5747)
at com.liferay.portal.service.impl.UserLocalServiceImpl.validate(UserLocalServiceImpl.java:5526)

in this case while if I try to add user manually it doesn't throw any exception.

In both cases (adding user by json or by interface) it execute my validator returning true!

Thank you guys!
Yogesh Garg, modificado hace 11 años.

RE: screen name can not have _ / character or email format

Junior Member Mensajes: 51 Fecha de incorporación: 10/11/08 Mensajes recientes
Hi Andromeda,

I have the similar requirement of using the email address as screenmame. Can you please tell me how you fix the issue to have email can be taken as screennames.

Thanks,
Yogesh.
sri p, modificado hace 9 años.

RE: screen name can not have _ / character or email format

Junior Member Mensajes: 85 Fecha de incorporación: 22/01/11 Mensajes recientes
Yogesh Garg:
Hi Andromeda,

I have the similar requirement of using the email address as screenmame. Can you please tell me how you fix the issue to have email can be taken as screennames.

Thanks,
Yogesh.


Hello there,

Does Email allowed as ScreenName in Liferay ?
If it is not allowed, could some one give an idea how to achieve this?

I appreciate everyone help!

Thanks,
Sri
billy chan, modificado hace 16 años.

RE: screen name can not have _ / character or email format

Junior Member Mensajes: 43 Fecha de incorporación: 19/11/07 Mensajes recientes
Thank all help, i've solved the problem now!
Thanks so much
Thomas Kellerer, modificado hace 14 años.

RE: screen name can not have _ / character or email format

Expert Mensajes: 490 Fecha de incorporación: 9/06/08 Mensajes recientes
This won't help with the / character.

Liferay refuses to support this.

http://issues.liferay.com/browse/LPS-4498
rabel rabel, modificado hace 13 años.

RE: screen name can not have _ / character or email format

New Member Mensajes: 3 Fecha de incorporación: 6/05/10 Mensajes recientes
are there a way to disable the validation?