private bool CheckBallyuser(string strUser, string strPass) { bool bResult; try { var oSecurityAuthenticate = new BallySecurityAuthentication(); var objProperty = new BallySecurityProperty { UserName = strUser, Password = strPass }; if (objProperty.UserName.ToUpper() != "BALLY") { objProperty.Password = oSecurityAuthenticate.EncryptUser(objProperty); bResult = oSecurityAuthenticate.ValidateUser(objProperty); } else bResult = oSecurityAuthenticate.ValidateUser(objProperty); } catch (Exception ex) { bResult = false; ExceptionManager.Publish(ex); } return bResult; }
private void Login_Button_Click(object sender, RoutedEventArgs e) { try { btnLogin.IsEnabled = false; IsAuthorized = false; var userObect = new Security.Manager.UserManager(oCommonUtilities.CreateInstance().GetConnectionString()); if ((txtUname.Text.ToUpper() == "CASH" && txtPWD.Password.ToUpper() == "DESK") || (txtUname.Text.ToUpper() == "BALLY" && CheckBallyuser(txtUname.Text, txtPWD.Password))) { IsAuthorized = true; User = userObect.GetUserObject(txtUname.Text, txtUname.Text, txtUname.Text); } else { var oSecurityAuthenticate = new BallySecurityAuthentication(); User = userObect.GetUserProfileByName(txtUname.Text); if (User != null && User.Password == CryptoHelper.CreateHash(txtPWD.Password) && SecurityHelper.HasAccess(User, Permission)) IsAuthorized = true; } if (!IsAuthorized) MessageBox.ShowBox("MessageID289"); Hide(); } catch (Exception ex) { ExceptionManager.Publish(ex); MessageBox.ShowBox("MessageID289"); } finally { btnLogin.IsEnabled = true; } }