public ActionResult Login(LoginModel login)
        {
            var users = _repository.GetAll();

            if (!users.Any(u => u.Username == login.Username && _desEncryptor.Decrypt(u.Password) == login.Password))
            {
                this.ModelState.AddModelError("Username", "Usuário e senha não conferem!");
                return(View(login));
            }
            FormsAuthentication.SetAuthCookie(login.Username, true);
            return(Redirect("/Home"));
        }
예제 #2
0
        private bool IsFirstAccess()
        {
            var logins = _loginJsonRepository.GetAll();

            return(logins == null || logins.Count == 0);
        }