SendGrid with Jiwa  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Re: SendGrid with Jiwa

Postby Mike.Sheen » Wed Aug 03, 2022 10:26 pm

DannyC wrote:Nope. Reset the SMTP password plenty of times thinking that it was wrong.


In that case, messagebox out encryptionObject.ErrorMessage and it might provide the reason for the exception.

If it's "Invalid encryption type specified" then it's an environment issue - it doesn't have the required cryptographic cipher suites available, and you're likely ALSO silently getting this error when resetting the password (SELECT * FROM HR_Staff would reveal this - look for any rows with "ERROR" as the SMTP Password).

It it's "Both a string and a key are required" then the password contains unacceptable characters, or there is something funky going on with the environment culture and datetime formats.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: SendGrid with Jiwa

Postby SBarnes » Thu Aug 04, 2022 10:16 am

Hi Danny,

Below is a section of code from one of our customers web stores into which the staff can login to, it uses the normal password and compares the encrypted values but largely the code could be changed to have a look at what's going on for the smtp one as well you just need to change it to use the smtp encrypted value and smtp last saved date and change request.LogonPassword to what ever value you are wanting to check.


Code: Select all
JiwaFinancials.Jiwa.JiwaServiceModel.Tables.HR_Staff hrstaff = Db.Select<JiwaFinancials.Jiwa.JiwaServiceModel.Tables.HR_Staff>().Where(s=> s.SName.ToUpper() == request.LogonCode.ToUpper() ).FirstOrDefault();
            if (hrstaff == null)
            {
               return result;
            }
            JiwaFinancials.Jiwa.JiwaEncryption.JiwaEncrypt jiwaEncrypt = new JiwaFinancials.Jiwa.JiwaEncryption.JiwaEncrypt();
            DateTime PDate = hrstaff.PasswordLastChangedDateTime == null ? DateTime.Now : (DateTime) hrstaff.PasswordLastChangedDateTime;
            string pwdenc = jiwaEncrypt.EncryptString(request.LogonPassword, manager.Database.FormatDateTime(PDate, true));


to get an ORM Lite database connection, Db in the above code, you do something like this

Code: Select all
  var dbFactory = new OrmLiteConnectionFactory(manager.Database.ConnectionString, ServiceStack.OrmLite.SqlServer2012Dialect.Provider);
var db = dbFactory.Open()
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1619
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 175

Re: SendGrid with Jiwa

Postby DannyC » Thu Aug 04, 2022 7:09 pm

messagebox out encryptionObject.ErrorMessage and it might provide the reason for the exception


"Not a valid hex string"

And to add a bit more info...Using Stuart's code above I have also confirmed that the encrypted HR_Staff.SMTPPassword is identical so I'm comfortable that the p/w has been encrypted and saved correctly.
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: SendGrid with Jiwa

Postby Mike.Sheen » Fri Aug 05, 2022 10:59 am

DannyC wrote:
messagebox out encryptionObject.ErrorMessage and it might provide the reason for the exception


"Not a valid hex string"

And to add a bit more info...Using Stuart's code above I have also confirmed that the encrypted HR_Staff.SMTPPassword is identical so I'm comfortable that the p/w has been encrypted and saved correctly.


I can tell you the code in the plugin to obtain the SMTP Password and decrypt it is identical to the code in the staff maintenance form business logic - so I believe it has got to be an environment thing.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: SendGrid with Jiwa

Postby Mike.Sheen » Fri Aug 05, 2022 11:01 am

Provide us with the SMTP Password text stored in the database, and the SMTP Last saved date time value in HR_Staff.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: SendGrid with Jiwa

Postby DannyC » Fri Aug 05, 2022 1:06 pm

Will send via email ;)
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: SendGrid with Jiwa

Postby Mike.Sheen » Fri Aug 05, 2022 1:07 pm

DannyC wrote:Will send via email ;)


No, don't do that.

If you can change the password via the Staff maintenance form as you said you can, just change it to "password" first and then send that.

It's not sensitive that way.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: SendGrid with Jiwa

Postby DannyC » Fri Aug 05, 2022 1:24 pm

Bugger, too late! The SMTP password is defined by my client's IT people & I don't have access to change it. Any way you've got the real p/w now.
I can fairly easily get their IT people to alter it later but for now let's just work with what we've got.
I'd rather that as it might be some decryption issue with special characters, not just 0-9 or A-Z.
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Re: SendGrid with Jiwa

Postby Mike.Sheen » Fri Aug 05, 2022 1:47 pm

Updated plugin attached.

Problem was that the plugin was decrypting the SMTP password when it was already decrypted.
Attachments
Plugin Multiple Email Providers 7.2.1.2.xml
(863.41 KiB) Downloaded 44 times
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: SendGrid with Jiwa

Postby DannyC » Fri Aug 05, 2022 3:29 pm

Bingo!

Deployed and tested. All good.
User avatar
DannyC
Senpai
Senpai
 
Posts: 636
Joined: Fri Mar 22, 2013 12:23 pm
Topics Solved: 30

Previous

Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 28 guests