public bool Authenticate() { bool result = false; try { if (settings.host != String.Empty) { SuiteCRMUserSession = new SuiteCRMClient.UserSession( settings.host, settings.username, settings.password, settings.LDAPKey, log, Settings.RestTimeout); SuiteCRMUserSession.AwaitingAuthentication = true; try { if (settings.IsLDAPAuthentication) { SuiteCRMUserSession.AuthenticateLDAP(); } else { SuiteCRMUserSession.Login(); } if (SuiteCRMUserSession.IsLoggedIn) { result = true; } } catch (Exception any) { ShowAndLogError(any, "Failure while trying to authenticate to CRM", "Login failure"); } } else { // We don't have a URL to connect to, dummy the connection. SuiteCRMUserSession = new SuiteCRMClient.UserSession( String.Empty, String.Empty, String.Empty, String.Empty, log, Settings.RestTimeout); } SuiteCRMUserSession.AwaitingAuthentication = false; } catch (Exception ex) { log.Error("ThisAddIn.Authenticate", ex); } return(result); }
public void Authenticate() { try { if (settings.host != String.Empty) { SuiteCRMUserSession = new SuiteCRMClient.UserSession( settings.host, settings.username, settings.password, settings.LDAPKey, log, Settings.RestTimeout); SuiteCRMUserSession.AwaitingAuthentication = true; try { if (settings.IsLDAPAuthentication) { SuiteCRMUserSession.AuthenticateLDAP(); } else { SuiteCRMUserSession.Login(); } if (SuiteCRMUserSession.IsLoggedIn) { return; } } catch (Exception) { // Swallow exception(!) } } else { // We don't have a URL to connect to, dummy the connection. SuiteCRMUserSession = new SuiteCRMClient.UserSession( String.Empty, String.Empty, String.Empty, String.Empty, log, Settings.RestTimeout); } SuiteCRMUserSession.AwaitingAuthentication = false; } catch (Exception ex) { log.Error("ThisAddIn.Authenticate", ex); } }
public bool Authenticate() { bool result = false; try { if (Properties.Settings.Default.Host != String.Empty) { SuiteCRMUserSession = new SuiteCRMClient.UserSession( Properties.Settings.Default.Host, Properties.Settings.Default.Username, Properties.Settings.Default.Password, Properties.Settings.Default.LDAPKey, ThisAddIn.AddInTitle, log, Properties.Settings.Default.RestTimeout); SuiteCRMUserSession.AwaitingAuthentication = true; try { if (Properties.Settings.Default.IsLDAPAuthentication) { SuiteCRMUserSession.AuthenticateLDAP(); } else { SuiteCRMUserSession.Login(); } if (SuiteCRMUserSession.IsLoggedIn) { LogServerVersion(); result = true; } } catch (Exception any) { ShowAndLogError( any, catalogue.GetString("Failure while trying to authenticate to CRM"), catalogue.GetString("Login failure")); } } else { // We don't have a URL to connect to, dummy the connection. SuiteCRMUserSession = new SuiteCRMClient.UserSession( String.Empty, String.Empty, String.Empty, String.Empty, ThisAddIn.AddInTitle, log, Properties.Settings.Default.RestTimeout); } SuiteCRMUserSession.AwaitingAuthentication = false; } catch (Exception ex) { log.Error("ThisAddIn.Authenticate", ex); } return(result); }