Пример #1
0
        public bool Login(string login, string password)
        {
            var user = _user.GetByLogin(login);

            if (!_attempts.CanLogin(user.Id))
            {
                Logoff();
                return(false);
            }

            if (_user.Login(login, password))
            {
                HttpContext.Current.Session["USER"] = user;
                _attempts.Delete(user.Id);
                return(true);
            }
            _attempts.Tentative(user.Id);
            Logoff();
            return(false);
        }