Wednesday, September 1, 2010

Enable user creation with duplicate email id

To enable user creation with duplicate email -id

If you don't have ant ext environment and still want to add this functionality leave me a note and I will send you steps for creating a separate jar and configurations to make your custom code work for your custom application.

For extension environment -- Write a new class in ext-environment

public class AbhishekUserLocalServiceImpl extends UserLocalServiceImpl
Now override two validate methods and make following changes

1. For method with signature
protected void validate(long userId, String screenName, String emailAddress, String firstName, String lastName, String smsSn)

remove ----> throw new DuplicateUserEmailAddressException();

from
if (userPersistence.fetchByC_EA(
user.getCompanyId(), emailAddress) != null) {

throw new DuplicateUserEmailAddressException();
}


2.
For method with signature

protected void validate(long companyId, long userId, boolean autoPassword, String password1,String password2, boolean autoScreenName, String screenName, String emailAddress, String firstName, String lastName, long[] organizationIds)

remove --->throw new DuplicateUserEmailAddressException();

from

if (Validator.isNotNull(emailAddress)) {
User user = userPersistence.fetchByC_EA(companyId, emailAddress);

if (user != null) {
throw new DuplicateUserEmailAddressException();
}
}

10 comments:

diego mauricio lagos said...

Thx a Lot

Anonymous said...

Hi,

I don't have an ext environment. But due to some issues with Liferay - Open AM user import , i'm getting this exception com.liferay.portal.DuplicateUserEmailAddressException when this
users.screen.name.always.autogenerate is set to true

users.screen.name.always.autogenerate=true

I raised as a bug in Liferay. But not sure of the work around

I would like to try the process of creating a jar file as you mentioned. Atleast i can see if ths exception goes away.

Looking for your response at chandrasekh@rediffmail.com

Anonymous said...

Hi,

Great article. Can you please send me instruction about creating an ext environment on my email address: robert_atanasoski@yahoo.com

10x,
Robert

Anonymous said...

Hi,

I dont have an ext environment. Please share the code ugetvikasv@gmail.com

Thanks in advance!

Best Regards,

Anonymous said...

Hi,

Could you please share the detail steps for enabling user creation with duplicate email-ids without using EXT Env.

Thanks,

Anonymous said...

Please use this to create jar

Extend class from UserLocalServiceImpl class.
Override 2 validate methods. Copy same from UserLocalServiceImpl java file, just remove dupicate email check.

create a jar file.
create a sprint xml file ,



In portal-ext.properties file specify following property

spring.configs=\
META-INF/activemq-spring-jms.xml,\
META-INF/data-source-spring.xml,\
META-INF/misc-spring.xml,\
META-INF/counter-spring.xml,\
META-INF/documentlibrary-spring.xml,\
META-INF/lock-spring.xml,\
META-INF/mail-spring.xml,\
META-INF/mail-spring-jms.xml,\
META-INF/portal-spring.xml,\

META-INF/portal-spring-jcr.xml,\
META-INF/portal-spring-jms.xml,\
META-INF/ext-spring.xml

Put jar file, protal-ext.properties and spring xml files in classpath.

Unknown said...

Hi,

Could you please share the detail steps for enabling user creation with duplicate email-ids without using EXT Env.

My Email Id: dinesh67.kumar@gmail.com

badri said...
This comment has been removed by the author.
badri said...

Hi ,
I have ext plugin for creating user with duplicate email in liferay 6.2 .Now im migrating to lifeay 7 dxp ..still can i use ext or can i do this through hook in liferay 7 please help me.

Chris said...

can you share with me the ext-plugin or the steps to create an ext-plugin please?
my email --> perezgarciachristian@gmail.com