Mix Logon (username or Email)

rafik maher asked on September 19, 2014 18:04

Hi guys,

I am trying to make the logon webpart connect with email or username but no success.

Can someone help me to succeed to make it happen in kentico 8.1.

Best regards

Recent Answers


Richard Sustek answered on September 22, 2014 09:21

Hi Rafik,

Thank you for your post.

Currently you can use only UserName to log a user in the system using AuthenticationHelper class, however you can get UserName out of the E-mail and then use the UserName for the authentication.

You can try something like this:

// Prepare the parameters
string where = "Email = 'andy@kentico.com'";

// Get the data from database
var users = UserInfoProvider.GetUsers().Where(where);

// Loop through the individual users
foreach (UserInfo user in users)
{

}

Be sure to set system to use unique e-mails when developing your login webpart. You can do so in Settings -> Security & Membership -> Require unique user e-mails

Also be sure that no more then 2 users are found with same e-mail, it might indicate some issues when trying to log in as you might log as someone else.

Let us know if you need anything else.

Kind regards,

Richard Sustek

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.