Portal Engine Questions on portal engine and web parts.
Version 4.x > Portal Engine > User Accounts with same Username View modes: 
User avatar
Member
Member
tspring-allegra - 10/19/2011 4:18:40 AM
   
User Accounts with same Username
Hi

I'm currently running two membership style sites on the same Kentico installation.

The problem I’m having is if I create a user account for one site, I can't create an independent user account with the same username for the other site.

I don't want to have one user account shared across the two site, as the sites are completely different and also don't want to confuse the user during registration by somehow relating the two sites. There really needs the ability to have two separate accounts (one registered to each site) both with possibly the same username (in cases where the same person tries to register on both sites - as people generally like to keep the same username).

I tried blanking out the following code in the RegistrationForm webpart:


if (UserInfoProvider.GetUserInfo(userName) != null)
{
lblError.Visible = true;
lblError.Text = ResHelper.GetString("Webparts_Membership_RegistrationForm.UserAlreadyExists").Replace("%%name%%", HTMLHelper.HTMLEncode(userName));
return;
}


...but even though this skips the form checking, I still get an application error about duplicate usernames in the UserInfoProvider.SetUserInfo(ui); line.

Is there anyway to override this and allow accounts with the same username? It seams like it should be an obvious function, especially if the accounts belong to different sites.

Thanks,
Tim

User avatar
Member
Member
kentico_michal - 10/21/2011 6:15:54 AM
   
RE:User Accounts with same Username
Hello,

Could you please try to set the Require unique user e-mails property to false?

You can find this property in the Site manager -> Settings -> Membership.

Best regards,
Michal Legen

User avatar
Member
Member
tspring-allegra - 10/21/2011 6:44:38 AM
   
RE:User Accounts with same Username
Hi,

Thanks for the reply. I've set the Require unique user e-mails to false, but I still have the problem.

I guess it's because I want to be able to create accounts where the Username is not required to be unique, not the email address.

Is there any way to have independent accounts with the same username when they are being registered to different sites on the same installation of Kentico?

Thanks,
Tim

User avatar
Member
Member
kentico_michal - 10/30/2011 3:54:24 AM
   
RE:User Accounts with same Username
Hello,

Well, regrettably, it is not possible to have more users with the same UserName even when they are assigned to different sites. The SetUserInfo method which is used to insert a new user contains code that checks whether there is already another user with the same UserName.

Beust regards,
Michal Legen

User avatar
Member
Member
tspring-allegra - 11/7/2011 6:17:54 AM
   
RE:User Accounts with same Username
Hi,

Is there any reason why it's like this?

Say for example I’m developing sites for two separate clients, who both operate in the same business sector. If both sites require membership registration, there is a high chance that each site will attract the same visitors. So someone who registers for Client A is not going to be able to register the same username with Client B, even though the clients and websites are completely independent with not relationship. This could confuse some users who like to keep a unique username across independent sites.

Are there any plans to alter this in future versions? It seams like it should be a basic ability within a membership site for it’s users to be independent of other member sites running on the same server and CMS install.

Thanks,
Tim

User avatar
Member
Member
kentico_michal - 11/9/2011 3:14:11 AM
   
RE:User Accounts with same Username
Hello,

Kentico CMS by default uses email address as UserName. Once the user is registered, he cannot change his UserName. Only global administrators are allowed to change UserNames.

However, in older versions of Kentico CMS including 4.x, the SetUserInfo method checked whether there is a user with the same UserName. This is the reason why you cannot create a new user with a username that already exists.

This approach has been changed and the new version of Kentico CMS 6.0 allows users to register when the Require unique user e-mails is set to false.

Best regards,
Micha Legen

User avatar
Member
Member
tspring-allegra - 11/9/2011 3:38:39 AM
   
RE:User Accounts with same Username
Hi,

How does the "Require Unique User Email" work across the system and individual sites in 6.0? Say I want unique email accounts within a site, but not across the whole system. Is this possible?

Thanks,
Tim

User avatar
Member
Member
kentico_michal - 11/18/2011 5:51:53 AM
   
RE:User Accounts with same Username
Hello,

Because of the fact that emails are used as the usernames, you could try to set the Use site prefix for user names property to true [Site manager -> Settings -> Security & Membership]. As a result, usernames (emails) will need to be unique for each site, not globally.

Best regards,
Michal Legen