Jump to content

ClientAreaCustomButtonArray in module - function not refreshing clientarea productdetails page


ralf333

Recommended Posts

I created some custom buttons in my provisioning module to show up in mydomain.com/clientarea.php?action=productdetails

 

 

Users can reset their service password there and change billing cycles with those buttons.

 

Pressing those buttons gives a nice success message on top of the productdetails page and the values are set in the database.

 

But unfortunatly the productdetails page still shows the old values after that.

 

What makes it even worse is that the URL in the browser changes to:

 

clientarea.php?action=productdetails&id=15&modop=custom&a=resetpassword

 

where "id" is the related serviceid and "resetpassword" is the name of the function behind the button.

 

So if a client would press the refresh button in the browser because he is still seeing the old values the button command (for example reset password) is sent again.

 

Now the values on the page are updated BUT before the reset password function is running. So one can see his password from the first reset now.

But as the reset password function is running right after the refresh of the page we end up with a productdetails page showing an invalid password again.

 

Opening the productdetails page again via the menu works fine, then it shows the updated values. Also hitting the "back" button in the browser shows the updated values.

 

Any hint on how to solve this issue is very much appreciated. Searching for hours now, but still do not have any idea how to fix it.

 

 

function mymodule_rsl_resetpassword($params) {

$id = $params["serviceid"];

$newpassword = "";

$length = 6;

$characters = array_merge(range('a','z'), range('A','Z'), range('0','9'));

$max = count($characters) - 1;

for ($i = 0; $i < $length; $i++) {

$rand = mt_rand(0, $max);

$newpassword .= $characters[$rand];

}

$password = str_replace('I', 'i', $password);

$password = str_replace('l', 'L', $password);

$command = "updateclientproduct";

$adminuser = "admin";

$values["serviceid"] = "$id";

$values["servicepassword"] = $newpassword;

$results = localAPI($command,$values,$adminuser);

}

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated