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

            if (_userAuthenctication.CheckLogin(model.Email, model.Password))
            {
                var user = _userRepository.Users.FirstOrDefault(u => u.Email == model.Email);
                if (!user.Confirmed)
                {
                    return(RedirectToAction("Confirm", new { email = user.Email }));
                }

                SignInUser(model.Email);
                return(RedirectToAction("Login"));
            }

            ModelState.AddModelError("", "Niepoprawny e-mail lub hasło");
            return(View());
        }