예제 #1
0
        public bool processUserLogin(bool notify)
        {
            using (EISCryptoService crypto_service = new EISCryptoService())
            {
                String passwordHash;
                // hash the password
                passwordHash = host.Services.CryptoService.EncryptStringAES(password, host.Services.CryptoService.GetPresharedKey());
                EISTransactionObject request = new EISTransactionObject();
                request.Tablename = " users JOIN hashtable JOIN userdetails ";
                request.ActionType = SQLActionType.Select;
                request.SelectCondition = " name = '" + username + "' " + " AND hash='" + password + "';";

                request.Content.Add(new ColValues("name"));
                request.Content.Add(new ColValues("hash"));
                request =  sql_processor.ProcessRequest(request);

                if (request.Content[0].Value.Count == 0 && notify)
                {
                    host.Notify("No user with such name found!", EISErrorTypes.Warning);
                    return debug ? true : false;
                }
                // if hashed password is same as password in database, then proceed

                if ((request.Content.Count > 0) && passwordHash == request.Content[0].Value[0])
                    return true;
                    //host.Notify("Sucessfuly logged in!", EISErrorTypes.Information
             }
            return false;
        }
예제 #2
0
 public EISTransactionObject ProcessRequest(EISTransactionObject request)
 {
     switch (request.ActionType)
     {
         case SQLActionType.Select:
             request = ProcesSelect(request);
             break;
     }
     return request;
 }
예제 #3
0
 private EISTransactionObject ProcesSelect(EISTransactionObject request)
 {
     request.Content = sql_connector.PerformSelect(request.Tablename, request.SelectCondition, request.Content);
     return request;
 }