VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: rvbgnu on August 11, 2020, 13:50:36 PM

Title: How to store a password longer than 99 characters in plugin parameters
Post by: rvbgnu on August 11, 2020, 13:50:36 PM
Hello,

I need to store larger API keys, and I found a strange issue: in the XML configuration of the plugin, I cannot store a password longer than 99 characters.

I have this example to explain better my concern:

<field name="test_secret_key" type="password" size="35" default="" label="VMPAYMENT_STRIPE_TEST_SECRET_KEY"
       description="VMPAYMENT_STRIPE_TEST_SECRET_KEY_DESC"/>
<field name="test_publishable_key" type="text" size="35" default=""
       label="VMPAYMENT_STRIPE_TEST_PUBLISHABLE_KEY"
       description="VMPAYMENT_STRIPE_TEST_PUBLISHABLE_KEY_DESC"/>


From the back end, when I save the test_secret_key, it is truncated after 99 chars. It is ONLY happening for the fields in XML type="password". With type="text" it can be larger, no problem.
I even tried to edit directly the Database: the longer key can be stored that way, and use in the front end plugin. But as soon as I edit in the back end, the test_secret_key gets truncated again.

I have tested with the Paypal plugin, and the type password behaves the same way.
http://dev.virtuemart.net/projects/virtuemart/repository/revisions/10338/entry/trunk/virtuemart/plugins/vmpayment/paypal/paypal.xml#L45 (http://dev.virtuemart.net/projects/virtuemart/repository/revisions/10338/entry/trunk/virtuemart/plugins/vmpayment/paypal/paypal.xml#L45)

Would you have any idea to solve that issue and update the code?

Thanks!
Title: Re: How to store a password longer than 99 characters in plugin parameters
Post by: AH on August 11, 2020, 14:22:22 PM
You should be able to override the "99"

https://docs.joomla.org/Text_form_field_type

"maxlength (optional) limits the number of characters that may be entered."


<field name="test_secret_key" type="password" size="35" maxlength="200" default="" label="VMPAYMENT_STRIPE_TEST_SECRET_KEY"
       description="VMPAYMENT_STRIPE_TEST_SECRET_KEY_DESC"/>
<field name="test_publishable_key" type="text" size="35" maxlength="200" default=""
       label="VMPAYMENT_STRIPE_TEST_PUBLISHABLE_KEY"
       description="VMPAYMENT_STRIPE_TEST_PUBLISHABLE_KEY_DESC"/>
Title: Re: How to store a password longer than 99 characters in plugin parameters
Post by: rvbgnu on August 11, 2020, 16:05:57 PM
Oh woah! Thanks a Millions AH!

It works perfectly!
After a fix release, I am going to update other similar fields, especially the API keys, password, passphrases, etc... and add it to the next minor release.

AH, I owe you one (or more). If you need the plugin at a discount, please just ping me!

Have a lovely day everyone!
Title: Re: How to store a password longer than 99 characters in plugin parameters
Post by: AH on August 11, 2020, 21:05:53 PM
Great to know it works for your problem and thanks for posting an update :-)

QuoteAH, I owe you one (or more).

I owe so many more people - it is nice to be able to help others :-)
Title: Re: How to store a password longer than 99 characters in plugin parameters
Post by: rvbgnu on August 13, 2020, 18:03:54 PM
Now, the release is public!
https://www.puma-it.ie/en/joomla-virtuemart-extensions/downloads/download-stripe-for-virtuemart/file/stripe-payment-plugin-2-3-2

And I usually do, I credited in the changelog the help received. Thank you AH!
Title: Re: How to store a password longer than 99 characters in plugin parameters
Post by: AH on August 13, 2020, 18:56:19 PM
"# Add support for New longer Stripe API keys (Thank you AH!)"

Nice touch :-)
Title: Re: How to store a password longer than 99 characters in plugin parameters
Post by: jenkinhill on August 13, 2020, 19:06:45 PM
@rvbgnu  this reminded me to update the Stripe plugin on a client site. Thanks.
Title: Re: How to store a password longer than 99 characters in plugin parameters
Post by: rvbgnu on August 14, 2020, 17:10:02 PM
Great stuff Kelvyn! Thanks to you for using our Stripe plugin ;-)