Example #1
0
        public ActionResult LogIn(LoginInput input)
        {
            var userAuth = new UserAuthService(new User { Email = input.Email }, Repo);

            if(ModelState.IsValid && userAuth.IsAuthenticated(input.Password))
                return AuthenticateAndRedirect(input.Email);

            return View(input);
        }
Example #2
0
        public ActionResult LogIn(LoginInput input)
        {
            if (!ModelState.IsValid) return View(input);

            var user = Users.FindOneBy(u => u.Email == input.Email);

            Auth.Authenticate(user, HttpContext.Response);
            return RedirectToAction("Index", "Home");
        }
 private Tuple<User, ActionResult> DoLogin(LoginInput input, User returnUser)
 {
     Repo.Setup(r => r.FindOneBy(It.IsAny<Func<User, bool>>())).Returns(returnUser);
     return new Tuple<User, ActionResult>(returnUser, Controller.LogIn(input));
 }