예제 #1
0
 /// <summary>
 /// 登录
 /// </summary>
 /// <param name="userID">用户ID</param>
 /// <param name="userPwd">用户密码,明文</param>
 /// <param name="validateCode">验证码</param>
 /// <returns>true-登录成功;false-登录失败</returns>
 public bool Login(string userID, string userPwd, string validateCode)
 {
     bool result = UserAuthService.Instance.Login(userID, userPwd, validateCode);
     if (result)
     {
         var user = UserAuthService.Instance.GetUserByUserID(userID);
         LoginAuthVM authUser = new LoginAuthVM()
         {
             UserSysNo = user.SysNo.Value,
             UserID = user.UserID,
             UserName = user.UserName,
             LoginDate = DateTime.Now,
             Timeout = DateTime.Now.AddMinutes(30),
             RememberLogin = true
         };
         WriteUserInfo(authUser);
     }
     return result;
 }
예제 #2
0
 /// <summary>
 /// 退出登录
 /// </summary>
 /// <returns></returns>
 public bool Logout()
 {
     LoginAuthVM authUser = new LoginAuthVM();
     WriteUserInfo(authUser);
     return true;
 }
예제 #3
0
 /// <summary>
 /// 写用户信息
 /// </summary>
 /// <param name="authUser">用户信息</param>
 public void WriteUserInfo(LoginAuthVM authUser)
 {
     CookieHelper.SaveCookie<LoginAuthVM>("LoginCookie", authUser);
     CookieHelper.SaveCookie<string>("UserNameCookie", authUser.UserName);
 }