我正在用mvc2开发一个网站,我正在使用.net身份验证。如何更改登录授权以使用电子邮件和密码。
感谢
答案 0 :(得分:1)
在发出身份验证Cookie的控制器操作中,只检查邮件是否与密码匹配,并使用电子邮件作为身份验证Cookie的用户名:
[HttpPost]
public ActionResult Login(string email, string password)
{
// TODO: query your membership provider and verify if the given email
// matches the password and if they match emit the authentication cookie
// using the email as username
}