salesagility / SuiteCRM-Outlook-Plugin

GNU Lesser General Public License v3.0
65 stars 68 forks source link

Login Fails with 3.0.18 #99

Open J-Light opened 5 years ago

J-Light commented 5 years ago

Issue

New version of Outlook Plugin Fails to Authenticate Users.

Expected Behavior

Plugin should login users.

Actual Behavior

Fails to login.

Possible Fix

index 2768d1d..08026e2 100644
--- a/SuiteCRMClient/UserSession.cs
+++ b/SuiteCRMClient/UserSession.cs
@@ -134,7 +134,7 @@ namespace SuiteCRMClient

             try
             {
-                loginReturn = AuthenticateCRM(username, hashedPass);
+                loginReturn = AuthenticateCRM(username, password);

                 id = loginReturn.SessionID;
                 SuiteCRMClient.RestAPIWrapper.SuiteCRMUserSession = this;
@@ -149,7 +149,7 @@ namespace SuiteCRMClient
                 _log.Error("Failed first login attempt", e1);
                 try
                 {
-                    loginReturn = AuthenticateCRM(username, password);
+                    loginReturn = AuthenticateCRM(username, hashedPass);

                     id = loginReturn.SessionID;
                     SuiteCRMClient.RestAPIWrapper.SuiteCRMUserSession = this;

Steps to Reproduce

  1. Use Suite 7.10.x
  2. Install Outlook Plugin version 3.0.18
  3. Attempt to authenticate

Context

We have a set of licenses that we cannot now use with this version. Previous version was missing libs for x64 Tidy.

Currently deployed open version for a select few. Would like to avoid this. Above seemed to fix it but not sure if its appropriate.

Logs

HResult:-2146233088
2019-05-01 15:52:34,162 | VSTA_Main | ERROR | Unable to connect to SuiteCRM
SuiteCRMClient.Exceptions.BadCredentialsException: CRM Server error 10 (Invalid Login): Login attempt failed please check the username and password
at SuiteCRMClient.CrmRestServer.CheckForCrmError(String jsonResponse, String payload)
at SuiteCRMClient.CrmRestServer.GetCrmResponse[T](String method, Object input)
at SuiteCRMClient.UserSession.AuthenticateCRM()
at SuiteCRMClient.UserSession.Login()
at SuiteCRMAddIn.Dialogs.SettingsDialog.btnTestLogin_Click(Object sender, EventArgs e)
Data:System.Collections.ListDictionaryInternal
HResult:-2146233088
2019-05-01 15:52:38,954 | VSTA_Main | ERROR | Failed calling 'login'
SuiteCRMClient.Exceptions.BadCredentialsException: CRM Server error 10 (Invalid Login): Login attempt failed please check the username and password
at SuiteCRMClient.CrmRestServer.CheckForCrmError(String jsonResponse, String payload)
at SuiteCRMClient.CrmRestServer.GetCrmResponse[T](String method, Object input)
Data:System.Collections.ListDictionaryInternal
HResult:-2146233088

Your Environment

cameronblaikie commented 5 years ago

Hi there,

We have recognised this issue and we are working as hard as we can to resolve this problem. If there are any other issues you are having with our Plugin could you please raise them on our support page on our store - https://store.suitecrm.com/support/SuiteCRM-official-outlook-plugin

Thanks,

simon-brooke commented 5 years ago

Profound apologies.

What's happened is that TLS 1.1 was disabled globally on 1st May. We knew this was going to happen and had already upgraded to a version of the .Net libraries which should use TLS 1.3 automatically, but clearly this isn't working.

According to documentation, if you have .Net 4.6.2 or above installed on your computer this should just work. Otherwise, some registry changes (see same documentation) should make it work.

However, I can confirm that at this stage it is not working for me either, although I have .Net 4.7.2 installed

What I'm seeing in the logs is as follows:

2019-05-02 17:13:24,730 | Background | ERROR | Login error
System.Exception: Could not construct 'login' request ---> System.Net.WebException: The request was aborted: Could not create SSL/TLS secure channel.
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at SuiteCRMClient.CrmRestServer.CreatePostRequest(String requestUrl, Byte[] bytes, String contentTypeAndEncoding) in C:\Users\Simon\Workspace\SuiteCRM-Outlook-Plugin\SuiteCRMClient\CrmRestServer.cs:line 281
   at SuiteCRMClient.CrmRestServer.CreateCrmRestRequest(String strMethod, Object objInput) in C:\Users\Simon\Workspace\SuiteCRM-Outlook-Plugin\SuiteCRMClient\CrmRestServer.cs:line 211

It's possible that the CRM end of the connection isn't supporting TLS 1.3. However, I appreciate that doesn't help users and we need to resolve this very fast.

simon-brooke commented 5 years ago

OK, I now have a build (3.0.19.119) which works; it turns out compiling against .Net 4.6.1 wasn't good enough, it had to be at least 4.6.2. I've passed this to quality control; hopefully we'll have a release very soon.

J-Light commented 5 years ago

@simon-brooke Thanks for this.

@cameronblaikie We did log it, but was disheartened to see a number of login issues already being reported with no feedback. I assumed it was not being monitored, so decided to open an issue here. Will use the store cases again in the future. Cheers!

simon-brooke commented 5 years ago

OK, status this morning: it still works for me, both in the dev environment and when installed from the installer. However, it isn't working for @cameronblaikie, and we have failed to establish what is different between my machine and his. We are putting full effort on this!

simon-brooke commented 5 years ago

@J-Light please could you confirm for me which Windows version you are running?

Dillon-Brown commented 5 years ago

@J-Light Rather than the contact form, could you send us an email directly to the outlook team? email address is: outlook@salesagility.com and we can get you a build send through. Thanks.

J-Light commented 5 years ago

@simon-brooke I am using Windows 10 Version 1809 (OS Build 17763.437)

image

simon-brooke commented 5 years ago

OK, I'm on Windows 7, and all the last three builds have worked for me. The test team are also on Windows 10, and the last three builds have not worked for them. It may be something to do with the Windows version, but I'm skeptical. However, I'm really running out of ideas.

Have you received either build 3.0.19.124 or 3.0.19.125?

J-Light commented 5 years ago

@simon-brooke no I have not, are the builds available in your branch, you able to point me to them?

J-Light commented 5 years ago

@Dillon-Brown @simon-brooke @cameronblaikie Obtained the plugin from SalesAgility 3.0.19.129 . Issue persists.

The fix proposed was able to overcome this issue. I suspect the hashedPass value is some how calculated incorrectly in Windows 10 (?).

samus-aran commented 5 years ago

Are you able to test this on the 3.0.22

J-Light commented 5 years ago

@samus-aran, unfortunately, it still does not work. We are using LDAP for password management. I have tried the addon with (CRM and client) and without (CRM and client) a password encryption key to no avail.

If I recompile the Addin that uses clear text password instead of MD5 hash for standard login, it appears to work (with no encryption key set on the CRM).

SyFry commented 4 years ago

I'm also unable to auth with Plugin 3.0.22 to SuiteCRM 7.8.31 with SSO enabled using the encryption key and Active Directory.