Пример #1
0
        public QCLoginResponseDTO LoginWebUser(string userName, string password)
        {
            QCLoginResponseDTO result = new QCLoginResponseDTO();
            //generate apikey token
            var APIKey   = AppUtil.GetUniqueKey();
            var APIToken = DateTime.Now.ToString().GetHashCode().ToString("x");

            //authenticate user
            result.loginStatus = UserRepository.LoginWebUser(userName, EncryptionEngine.EncryptString(password));
            result.APIKey      = APIKey;
            result.APIToken    = APIToken;

            //save apikey and token in Database
            if (result.loginStatus > 0)
            {
                RaceRepository.generateAPIKeyToken(APIKey, APIToken, result.loginStatus);
            }

            return(result);
        }