예제 #1
0
        // GET: Home
        public ActionResult Login(string Account, string Password)
        {
            switch (Account.ToLower())
            {
            case "admin":
                if (Password.ToLower() != "admin")
                {
                    return(wrongPassword());
                }
                break;

            case "aaa":
                if (Password.ToLower() != "aaa")
                {
                    return(wrongPassword());
                }
                break;

            case "bbb":
                if (Password.ToLower() != "bbb")
                {
                    return(wrongPassword());
                }
                break;

            case "ccc":
                if (Password.ToLower() != "ccc")
                {
                    return(wrongPassword());
                }
                break;

            default:
                return(wrongPassword());

                break;
            }

            code.HQuser user = new code.HQuser()
            {
                account = Account, password = Password, id = 1
            };

            this.Session["user"] = user;
            HQAuthenticationManager.HQLogin(Account);
            return(RedirectToAction("Main"));
            // return View();
        }
        public async Task <ActionResult> Login(UserIdentity model)
        {
            HQAuthenticationManager.HQLogin("admin");

            return(Content("admin"));

            //var v = zhuche(model).Result;

            // var user = await UserManager.FindAsync(model.UserName, model.Password);
            var user = await UserManager.FindByNameAsync(model.UserName);

            //UserIdentity Uidentity = new UserIdentity();
            //Uidentity.


            if (user != null)
            {
                await SignInAsync(user, model.RememberMe);

                //  return Content("ok");
                return(RedirectToAction("Main"));
            }
            return(Content(""));
        }