예제 #1
0
        public ActionResult Login(LoginViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return View(model);

            }
            // TODO: Creating a loginService that checks the input with the database.
            if (model.Username == "*****@*****.**" || model.Password == "123456")
            {
                var identity = new ClaimsIdentity(new[]
                {
                    new Claim(ClaimTypes.Name, "FuckYourDad"),
                    new Claim(ClaimTypes.NameIdentifier, "*****@*****.**"),
                    new Claim(ClaimTypes.Country, "Philippines")
                }, "ApplicationCookie");

                var ctx = Request.GetOwinContext();
                var authManager = ctx.Authentication;
                authManager.SignIn(identity);

                return Redirect(GetRedirectUrl(model.ReturnUrl));
            }
            ModelState.AddModelError("", "Invalid username or password");

            return View(model);
        }
예제 #2
0
        public ActionResult Login(string returnUrl)
        {
            var model = new LoginViewModel
            {
                ReturnUrl = returnUrl
            };

            return View(model);
        }