示例#1
0
 /// <summary>
 /// 會員登入
 /// </summary>
 /// <returns></returns>
 public string LoginCheck(string UserAccount, string Password)
 {
     if (userWeb.CheckAccount(UserAccount))
     {
         //驗證密碼
         if (userWeb.CheckPassword(UserAccount, Password))
         {
             return("");
         }
         else
         {
             return("密碼輸入錯誤...");
         }
     }
     else
     {
         return("找不到帳號...");
     }
 }
示例#2
0
        public ActionResult Login(Library.User user, string UserAccount, string Password)
        {
            //驗證帳號和密碼
            User loginUser = userWeb.CheckPassword(UserAccount, Password);

            if (loginUser != null)
            {
                SessionManagement.LoginUser = loginUser;
                Session["UserAccount"]      = loginUser.UserAccount;
                Session["Id"]        = loginUser.Id;
                Session["UserClass"] = loginUser.UserClass;
                Session["UserName"]  = loginUser.UserName;
                return(RedirectToAction("Index", "Message"));
            }
            else
            {
                ViewBag.Msg = "帳號或密碼輸入錯誤...";
                return(View());
            }
        }
示例#3
0
        public ActionResult Login(Library.User user, string UserAccount, string Password)
        {
            //驗證帳號和密碼
            if (userWeb.CheckPassword(UserAccount, Password))
            {
                Session["UserAccount"] = UserAccount;
                var users = userWeb.GetUsers().ToList()
                            .First(x => x.UserAccount == UserAccount);

                Session["Id"]        = users.Id;
                Session["UserClass"] = users.UserClass;
                Session["UserName"]  = users.UserName;

                return(RedirectToAction("Index", "Message"));
            }
            else
            {
                ViewBag.Msg = "帳號或密碼輸入錯誤...";
                return(View());
            }
        }