Exemplo n.º 1
0
        public virtual ActionResult Index(LogOnModel input)
        {
            var user = RavenSession.GetUserByEmail(input.Login);

            if (user == null || user.ValidatePassword(input.Password) == false)
            {
                ModelState.AddModelError("UserNotExistOrPasswordNotMatch",
                                         "Email and password do not match to any known user.");
            }
            else if (user.Enabled == false)
            {
                ModelState.AddModelError("NotEnabled", "The user is not enabled");
            }

            if (ModelState.IsValid)
            {
                signInHelper.SignIn(input, true);
                return(RedirectFromLoginPage(input.ReturnUrl));
            }

            return(View(new LogOnModel {
                Login = input.Login, ReturnUrl = input.ReturnUrl
            }));
        }