private void testLDAPCxnButton_Click(object sender, EventArgs e) { if (!(((infoFlag & (uint)REQINFOFLAGS.LOGIN) > 0) && ((infoFlag & (uint)REQINFOFLAGS.PASSPOLICY) > 0) && ((infoFlag & (uint)REQINFOFLAGS.PASSWORD) > 0) && ((infoFlag & (uint)REQINFOFLAGS.PORT) > 0) && ((infoFlag & (uint)REQINFOFLAGS.SERVER) > 0) && ((infoFlag & (uint)REQINFOFLAGS.USERDN) > 0) && (infoFlag & (uint)REQINFOFLAGS.USERIDKEY) > 0)) { MessageBox.Show("Please enter all required data for LDAP connection.", "PawnStoreSetup Alert", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } //Ensure LDAP login field is properly //formatted string login = LDAPLogin; if (LDAPLogin.IndexOf("cn=", StringComparison.OrdinalIgnoreCase) == -1) { login = "******" + LDAPLogin; } //Call LDAP connection class if (PawnLDAPAccessor.Instance.State == PawnLDAPAccessor.LDAPState.DISCONNECTED) { PawnLDAPAccessor.Instance.InitializeConnection( this.LDAPServer, this.LDAPPort, login, LDAPPassword, LDAPPassPolicyDN, LDAPUserDN, LDAPUserIdKey); } LDAPCxnSuccess = false; if (PawnLDAPAccessor.Instance.State == PawnLDAPAccessor.LDAPState.CONNECTED) { this.LDAPPwdPolicy = PawnLDAPAccessor.Instance.PasswordPolicy; LDAPCxnSuccess = true; } if (!LDAPCxnSuccess) { MessageBox.Show( "LDAP Connection Failed. Please change the field values and try again."); return; } //Show message box that LDAP is now connected MessageBox.Show("LDAP Connection Successful", "PawnStoreSetup Alert"); //Enable test user search and done button this.testSearchButton.Enabled = false; this.testSearchUserTextBox.Enabled = true; this.testPasswordSearchTextBox.Enabled = true; this.doneButton.Enabled = true; //Disable test connection button this.testLDAPCxnButton.Enabled = false; }