Exemplo n.º 1
0
        public IActionResult Login([FromForm] LoginParameter parameter)
        {
            User user = UserServer.GetLoginResult(parameter.Mail, parameter.Password, _usercontext);

            if (user == null)
            {
                ViewData["info"] = "账号或密码错误";
                ViewData["Mail"] = parameter.Mail;
                ViewData["Pwd"]  = parameter.Password;
                return(View());
            }
            else
            {
                Response.Cookies.Delete("SessionCode");
                Response.Cookies.Append("SessionCode", user.SessionCode);
                return(RedirectToAction("Index", "Main"));
            }
        }