Problem with a Roundcube plugin and cPanel

Astral God

Well-Known Member
Sep 27, 2010
180
0
66
127.0.0.1
cPanel Access Level
Root Administrator
Hello all cPanel users and devs. ;)

I'm having a litle problem with a Roundcube webmail plugin. This one was written to let the users change their emails account passwords through Roundcube. The plugin works well, but, only when the cPanel language is English. In my case, cPanel is in French language, so, the plugin works (the password is correctly changed) but the plugin interface returns an error saying that the system as an error and the password can't be changed.

If you want moire details, just check this thread in Roundcube Trac system:

#1487015 (Password plugin always return error even if it works good) – Roundcube Webmail

this attached file: Attachment – Roundcube Webmail

and specialy this comment from alec:

"So, I see the cPanel response is in French (I'm not sure, but it's not in English). Password's driver works only with English response. I'm not its author. I don't know cPanel too, but maybe there's a way to force English in HTTP response. Maybe some GET parameter or HTTP request header? "
Can someone helps me fixing this ? Thanks a lot. :)
 

cPanelDavidN

Well-Known Member
Staff member
Dec 17, 2009
571
3
68
Houston, TX
cPanel Access Level
Root Administrator
Hi Astral God,

Taking a quick look at the RoundCube cPanel driver (cpanel.php). It looks like they are not coding against our APIs.

Simply, they should be using the API2 call Email::passwdpop and Email::liskpopswithdisk. Instead they are coding against the UI, which as you've observed first hand, is a fragile method of programmatic coding.

It's very clear where the problem is; this driver will always return a failure message for any language other than English:
Code:
94 if(strpos($response, 'success') && !strpos($response, 'failure'))
91	                {
92	                        return true;
93	                }
The above code shows that their scanning the HTML return page for the English word Success or Failure. These words will change based on the language setting of cPanel. The API will always return English words PLUS it returns an integer result: 1 for success, 0 for failure.

It shouldn't be too difficult to refactor the cPanel driver. If I get a moment, I'll see what I can do. I can't make any promises since this is not our code; I'm kinda swamped with work and the cPanel conference is next week (gotta get ready!).

Best Regards,
-DavidN
 

Astral God

Well-Known Member
Sep 27, 2010
180
0
66
127.0.0.1
cPanel Access Level
Root Administrator
Ok thank you for your help.

I've trackback your answer to Roudcube Trac to the attention of developers of Roudcube Plugins with cPanel. Maybe in the future they will use the APIs. :)
 

acmeous

Registered
Feb 20, 2012
1
0
51
cPanel Access Level
Root Administrator
I was facing the same issue with my BlueHost hosting. Though my errors were in English only :).
I solved that problem with help of RoundCube Forum members and you will need an updated patched cPanel driver which does the trick.
Here is how I solved it - /http://acmeous.blogspot.in/2012/02/how-to-enable-change-password-for.html
I documented the process as well as I can so that it can help you guys also. Let me know if this works for you too.