Foren

Duplicate Email id for user creation

Test Test Test, geändert vor 15 Jahren.

Duplicate Email id for user creation

Junior Member Beiträge: 38 Beitrittsdatum: 21.03.08 Neueste Beiträge
We integrated Liferay with siteminder. Implemented login hook which creates user in Liferay. For us username/screenname is unique. But multiple users can have same email id. So we would like to allow duplicate email ids. Right now create user is throwing DuplicateEmail id exception. How do we by pass this check and allow duplicate email ids?
Thanks for your help.
UA
Test Test Test, geändert vor 15 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 38 Beitrittsdatum: 21.03.08 Neueste Beiträge
Please someone help with this one. Thanks UA
thumbnail
Wilson Man, geändert vor 15 Jahren.

RE: Duplicate Email id for user creation

Liferay Master Beiträge: 581 Beitrittsdatum: 21.06.06 Neueste Beiträge
out of the box, this isn't configurable since the portal checks for that during user creation. you'll have to modify the code to not validate unique email address .... probably in UserLocalServiceImpl.
thumbnail
Suresh N, geändert vor 15 Jahren.

RE: Duplicate Email id for user creation

Liferay Master Beiträge: 690 Beitrittsdatum: 18.08.04 Neueste Beiträge
i dont think this is right as a security issue,

you can create users as wilson said But

different users have a same email address means ---------- Forgot password or email reminders(calendar, message board) is confusing that if users giving the same emailaddress. so you need to customize some more areas depends on errors.


Cheers
Suresh Nimamkayala
Jaime Luis López, geändert vor 15 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 59 Beitrittsdatum: 24.05.07 Neueste Beiträge
Hi, I 'm looking for the same functionality, in my portal I don't need the restriction of the unique email because we don't use it for anything at the moment and we don't expect to use it. we are developing a portal for a virtual mobile operator and every user identificates against an LDAP via the mobile number, but a same customer can have several counts with diferent mobile number but same email.

Can anybody tall me how to remove the email restriction?even, remove the email.

Thank you
thumbnail
Lari Tuominen, geändert vor 15 Jahren.

RE: Duplicate Email id for user creation

Expert Beiträge: 283 Beitrittsdatum: 07.11.07 Neueste Beiträge
Hi all,

Is there any decent solution for allowing duplicate email addresses? Anyone tried?

- Lari
Test Test Test, geändert vor 15 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 38 Beitrittsdatum: 21.03.08 Neueste Beiträge
There is no easy way as far as I know.
I did following:

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 ,
<bean id="com.liferay.portal.service.UserLocalService.impl" class="com...YourUserLocalServiceImpl" lazy-init="true" />


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,\
<SPECIFY YOUR SPRING XML FILE HERE>
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.
Matthew O Smith, geändert vor 14 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 43 Beitrittsdatum: 29.04.09 Neueste Beiträge
For Liferay 5.2.3, use:



spring.configs=\
        META-INF/base-spring.xml,\
        \
        META-INF/hibernate-spring.xml,\
        META-INF/infrastructure-spring.xml,\
        META-INF/management-spring.xml,\
        \
        META-INF/util-spring.xml,\
        \
        META-INF/editor-spring.xml,\
        META-INF/jcr-spring.xml,\
        META-INF/messaging-spring.xml,\
        META-INF/scheduler-spring.xml,\
        META-INF/search-spring.xml,\
        \
        META-INF/counter-spring.xml,\
        META-INF/document-library-spring.xml,\
        META-INF/lock-spring.xml,\
        META-INF/mail-spring.xml,\
        META-INF/portal-spring.xml,\
        YOUR XML HERE,\
        META-INF/portlet-container-spring.xml,\
        META-INF/wsrp-spring.xml,\
        \
        META-INF/mirage-spring.xml,\
        \
        #META-INF/dynamic-data-source-spring.xml,\
        #META-INF/shard-data-source-spring.xml,\
        \
        META-INF/ext-spring.xml
Matthew O Smith, geändert vor 14 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 43 Beitrittsdatum: 29.04.09 Neueste Beiträge
When I do this, I get :

problem with class file or dependent class; nested exception is java.lang.NoClassDefFoundError: com/liferay/portal/service/impl/UserLocalServiceImpl
	at com.liferay.portal.spring.annotation.BeanReferenceAnnotationBeanPostProcessor.postProcessAfterInstantiation(BeanReferenceAnnotationBeanPostProcessor.java:68)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:959)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:472)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:269)
	... 33 more


The UserLocalServiceImpl exists but is in the liferay war, not in the Glassfish domain1/lib. Any ideas?
Matthew O Smith, geändert vor 14 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 43 Beitrittsdatum: 29.04.09 Neueste Beiträge
Putting the jar in the domains/domain1/lib directory is the wrong place. It needs to go into the Liferay classpath, not the Glassfish classpath
Matthew O Smith, geändert vor 14 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 43 Beitrittsdatum: 29.04.09 Neueste Beiträge
It looks like there is an index on the USER_ table that requires that companyid and emailaddress are required to be unique. On our system the index name is IX_615E97A but that looks like a generated name.

Any way around this?
thumbnail
artur versiani varella, geändert vor 14 Jahren.

RE: Duplicate Email id for user creation

New Member Beiträge: 10 Beitrittsdatum: 11.09.09 Neueste Beiträge
Hi ya,
Depending on your requirements you can add a fake email and use additional emails on each profile.
Cheers,
Artur
thumbnail
Wilson Man, geändert vor 14 Jahren.

RE: Duplicate Email id for user creation

Liferay Master Beiträge: 581 Beitrittsdatum: 21.06.06 Neueste Beiträge
you may try dropping that db index if you don't need it. it may affect performance still since liferay core may still try to look up users by those two columns.

Just out of curiosity though, what is your requirement like so that the email field needs to allow duplicates? Or is it more like you don't use the email field?
Matthew O Smith, geändert vor 14 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 43 Beitrittsdatum: 29.04.09 Neueste Beiträge
Wilson Man:

Just out of curiosity though, what is your requirement like so that the email field needs to allow duplicates? Or is it more like you don't use the email field?


Our project is to move off a Vignette portal and on to Liferay. The project allows patients to access their medical records online and we currently have over 50,000 users. As we have never prevented users from sharing an email account, there are a certain number of accounts that have duplicate email addresses.

Having duplicates is not a problem in our environment as our emails contain no "personal" information, just generic notifications. There is a slight possibility for confusion as it may not be clear which account the email relates to but in over 6 years of people using the system there haven't been any complaints.

Requiring a separate email address will then make people who share an email address for everything else setup a new account just for our application. It will then be ignored and will be worse than allowing the duplicates.
Matthew O Smith, geändert vor 14 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 43 Beitrittsdatum: 29.04.09 Neueste Beiträge
I did drop the index and haven't seen anything bad yet.
thumbnail
Ravi Kumar Gupta, geändert vor 13 Jahren.

RE: Duplicate Email id for user creation

Liferay Legend Beiträge: 1302 Beitrittsdatum: 24.06.09 Neueste Beiträge
Matthew O Smith:

Our project is to move off a Vignette portal and on to Liferay. The project allows patients to access their medical records online and we currently have over 50,000 users. As we have never prevented users from sharing an email account, there are a certain number of accounts that have duplicate email addresses.

Having duplicates is not a problem in our environment as our emails contain no "personal" information, just generic notifications. There is a slight possibility for confusion as it may not be clear which account the email relates to but in over 6 years of people using the system there haven't been any complaints.

Requiring a separate email address will then make people who share an email address for everything else setup a new account just for our application. It will then be ignored and will be worse than allowing the duplicates.


Try with an integration with LDAP and OpenSSO.

1. Dont put emails in LDAP.
2. Integrate LDAP with OpenSSO. [Already done, you just need to provide configurations]
3. Integrate Liferay with OpenSSO. [Already done, you just need to provide configurations]
4. Dont map with email ids when configuring with OpenSSO.

Try logging in with username in opensso.. it should work.. hopefully.

Thanks
Ravi Kumar Gupta
Jimit Shah, geändert vor 9 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 62 Beitrittsdatum: 05.02.14 Neueste Beiträge
Wilson Man:
you may try dropping that db index if you don't need it. it may affect performance still since liferay core may still try to look up users by those two columns.

Just out of curiosity though, what is your requirement like so that the email field needs to allow duplicates? Or is it more like you don't use the email field?


Hi,
I have a similar requirement of allowing duplicate email address.
Currently I am using liferay 6.2 SP10 EE version.
Is it fine to delete the index?
I am asking just to ensure if deleting won't cause any problems in portal behavior.
Slowness is not much of a problem.

Thanks.
Venkat Koppavolu, geändert vor 13 Jahren.

RE: Duplicate Email id for user creation

Junior Member Beiträge: 85 Beitrittsdatum: 26.07.10 Neueste Beiträge
Similar kid of requirement in our previous project working with Liferay 5.1(2 years back)
Where each user doesn't have their own emailAddess, they will use their school or universiry email and logged into system.

We have followed below steps while developing this feature;
if you feel it's better u can use it or let me know if you find any better way of to this.

Note: In our requirement students will logged into the system using screenName; Not used *ByEmailAddress() any where in the system to get User Object.
since it's common email for more than one user in the system.

1. Generated Email by using screenName in CustomUserEditAction.java

ex: username = venkat.kumar
emailAddress = venkat.kumar@dummy.com

2. Used Liferay's API to add user into the LR DB.

3. Used Expando tables feature and added the orginalEmailAddress into it.

TableName - CUSTOM_FIELDS
ColumnName - orginalEmailAddress

4. Overridden UserLocalServiceImpl.java where emailAddress methods.

eg:

public User getUserById(long companyId, long userId)
throws PortalException, SystemException {

User user = userPersistence.findByPrimaryKey(userId);

//classPK is the userId in ExpandoValue table.
String orginalEmailAddress = getData(companyId, "com.liferay.portal.model.User", "CUSTOM_FIELDS", "orginalEmailAddress", userId);
user.setEmailAddress(orginalEmailAddress);

return user;
}

5. Forgot Password and other functionalities which is related to emailbased things will directly send to school or universiry email, from their it will
pass to students.