合并最新
This commit is contained in:
@@ -71,6 +71,38 @@ namespace BLL
|
||||
page.Response.Cookies["UserInfo"].Expires = DateTime.Now.AddDays(-1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 用户登录成功方法
|
||||
/// </summary>
|
||||
/// <param name="loginname">登录成功名</param>
|
||||
/// <param name="password">未加密密码</param>
|
||||
/// <param name="rememberMe">记住我开关</param>
|
||||
/// <param name="page">调用页面</param>
|
||||
/// <returns>是否登录成功</returns>
|
||||
public static bool UserLogOnByAccount(string account, System.Web.UI.Page page)
|
||||
{
|
||||
var x = (from y in Funs.DB.Sys_User
|
||||
where y.Account == account && y.IsPost == true
|
||||
select y);
|
||||
if (x.Any())
|
||||
{
|
||||
string accValue = HttpUtility.UrlEncode(account);
|
||||
FormsAuthentication.SetAuthCookie(accValue, false);
|
||||
page.Session[SessionName.CurrUser] = x.First();
|
||||
|
||||
// 当选择不保存用户名时,Cookies过期时间设置为昨天.
|
||||
page.Response.Cookies["UserInfo"].Expires = DateTime.Now.AddDays(-1);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user