0

I have a requirement that a user can register multiple times in the website using same email address. There is an internal logic that based on the company they are they see a particular home page and access.

Does Liferay support multiple accounts with same email address. I think there is validation done in UserLocalServiceImpl to check duplicate email address, so maybe its not possible and I have to override and create a service wrapper. Still giving it a try.

jww
  • 97,681
  • 90
  • 411
  • 885
Sandeep Nair
  • 3,630
  • 3
  • 26
  • 38
  • Are you talking of _companies_ = _portal instances_ or _companies_ = _organisations_? In the first it is possible, as the duplication check is only per portal instance. – Tobias Liefke May 13 '15 at 14:45

1 Answers1

4

No, Liferay does not support to use the same email address for multiple accounts. I doubt that a service wrapper that weakens the check for duplicates will help you - I'm rather expecting that you can run into problems later.

Unfortunately I can't name the problems (otherwise it would be easy to work around them) (but see Tobias' comment below for why it's actually impossible).

The only exception to this rule is what Tobias mentions in his comment to your question: If you use different instances (called company in the API), you'll be able to use each email address exactly once per instance.

Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
  • 1
    There are many, for example because `UserService.getUserByEmailAddress` always returns only one user. And that one is for example used by the "forgot password" action. – Tobias Liefke May 13 '15 at 14:41
  • Good example. I didn't bother thinking deeper about this problem. Given the usecase that you mention I'd say that it's not hard but impossible to change. I'll edit with regards to your comment on instances... – Olaf Kock May 13 '15 at 14:53
  • Unfortunately by company I meant organizations and we can have only one portal instance. We have a use case where multiple generic accounts have same email address but different usernames. Admin logs in using unique username to one of these generic accounts. And he expects to get email from all these generic account.. I have a migration job to do where from the existing legacy db, I have to migrate users into liferay. One way i could think of is to create dummy email address while migrating and associate a custom attribute all pointing to same email. – Sandeep Nair May 13 '15 at 18:11
  • in case that email is going through gmail (maybe with others as well, I only know it there) you can "invent" additional parts of the mail addresses. E.g. if the name part of a gmail address is "firstname.lastname", any email to "firstname.lastname+something" (at gmail.com) will go to the same recipient without any need for configuration. – Olaf Kock May 13 '15 at 20:16