/// <summary> /// Authenticate access using Login Name (NO PASSWORD). /// </summary> /// <param name="sLogin"></param> /// <returns></returns> private bool AuthenticateNoPassword(string sLogin) { bool bAuthenticated = false; string sResponse = string.Empty; try { sResponse = TableHelper.GetScalar("tSysUser", "LoginID", "(LoginID = '" + sLogin + "') AND (IsCurrent = 'Y')"); if ((sResponse != string.Empty) & (sResponse == sLogin)) { bAuthenticated = true; } } catch (Exception ex) { FormErrorHandler frmError = new FormErrorHandler(ex); frmError.Show(); } return bAuthenticated; }
/// <summary> /// Authenticate access using both Login Name and (hashed) Password. /// </summary> /// <param name="sLogin"></param> /// <param name="sHash"></param> /// <returns></returns> private bool AuthenticatePassword(string sLogin, string sHash) { bool bAuthenticated = false; string sDBHash = string.Empty; try { sDBHash = TableHelper.GetScalar("tSysUser", "LoginHash", "(LoginID = '" + sLogin + "') AND (IsCurrent = 'Y')"); //debug //MessageBox.Show(sHash, "Hash from Login", MessageBoxButtons.OK, MessageBoxIcon.Information); //MessageBox.Show(sDBHash, "Hash from DB", MessageBoxButtons.OK, MessageBoxIcon.Information); //debug if ((sDBHash != string.Empty) & (sDBHash == sHash)) { bAuthenticated = true; } } catch (Exception ex) { FormErrorHandler frmError = new FormErrorHandler(ex); frmError.Show(); } return bAuthenticated; }