OpenGamePanel / OGP-WHMCS

WHMCS OGP Integration Mod
6 stars 9 forks source link

Automatic setup failed because of character limits #8

Closed xRJx closed 4 years ago

xRJx commented 4 years ago

I noticed that on some occasions the automatic server creation would fail and I narrowed it down to the length of some of the fields (between Server name, RCON password, and FTP password). I did some further testing and found out that the automatic server creation will fail if the FTP password is longer than 16 characters. I couldn't find anything in the API's code that would be causing this so I'm guessing it's a restriction on the game panel's end.

I've rectified this by using regex to limit the number of characters that can be used in that particular field: /^.{1,16}$/

edit: Upon some further investigation I've found that the RCON password field is limited to 32 characters so I used this regex: /^.{1,32}$/

Also the Server name is limited to 128 so the regex for that is the following: /^.{1,128}$/

My recommendation is to update the installation document to include adding these regex values to their appropriate fields to prevent automatic creation failures.

own3mall commented 4 years ago

Have you checked the database schema to see if those lengths correspond with what you discovered? If so, you can change it yourself at the database level.

Also, it would really be helpful if you included a pull request with your changes if you want others to benefit from them,

own3mall commented 4 years ago

@xRJx The limits have been increased by the latest update: https://github.com/OpenGamePanel/OGP-Website/pull/515/commits/ed941e51bab20b2f30d3cc5c5e7b2d35e366df4a

However, if you applied regex checking somewhere in the WHMCS code, please open a pull request with those changes.

xRJx commented 4 years ago

Awesome! I didn't add anything code-wise per se, but rather I added it into the Validation field directly in WHMCS under Custom Fields like so: https://i.gyazo.com/4eebae2d07b8d13aa7e8deecf94612b8.png