Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > Login with both username and email View modes: 
User avatar
Member
Member
damon.amanabadi-artisgroup.com - 7/4/2011 8:49:40 PM
   
Login with both username and email
Hi ,

Would you please give me some hints in order to how to enable users to login to my website using both username and email address . The login form also should change to "Username/email" as the first textbox title.

Cheers,

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 7/5/2011 10:05:02 AM
   
RE:Login with both username and email
Hello,

You will have to modify the log on web parts which are used on your site. The customization shouldn't be too difficult. You just need to check the database entries for the user according to the user name and if this fails, you will try to authenticate the user with the e-mail address. To change a standard web part please check this documentation. To authenticate an user please check this code. For more information on the mentioned methods and tables please check this and this link.

Best regards,
Boris Pocatko

User avatar
Member
Member
vinay.malviya-cebsworldwide - 2/13/2013 7:36:56 AM
   
RE:Login with both username and email
Hi,
I am trying to do this but unable to login with both user name and email id, can you please send me code that i will implement in my page so that user can login by using both, currently user can login only by using user name.

User avatar
Member
Member
kentico_davidb2 - 2/19/2013 8:18:01 AM
   
RE:Login with both username and email
Hello,

if you want to enable users to log in using email also, you can use:
http://devnet.kentico.com/docs/devguide/security_handler.htm

with code similar to:
public override object OnAuthentication(object userInfo, string username, string password)
{
if (userInfo != null)
{
return userInfo;
}
else
{
var user = UserInfoProvider.GetUsers("Email LIKE '" + username + "'", "", 1, "UserName");
var userName = (string)user.Tables[0].Rows[0].ItemArray[0];
return UserInfoProvider.GetUserInfo(userName);
}
}

David