ftp accounts not showing created accounts (stuck) from user cwp

Started by tg040, February 12, 2020, 05:06:03 PM

Previous topic - Next topic

tg040

When going to ftp accounts under the user account cwp (reports/?module=ftp_accounts), the list of accounts is stuck and loading forever. Does anyone know how to solve it?

rcschaff

Check the error log.  Might be a file/system lock preventing access.  And timeout for cwpsrv is high.
Google Hangouts:  rcschaff82@gmail.com

tg040

pureftp has an error log? do you know where? thank you for your suggestion.

tg040



rcschaff

Google Hangouts:  rcschaff82@gmail.com

tg040

nothing there too. thanks for the tip. never looked at this log file. some interesting stuff.

royer_guerra@hotmail.com

Quote from: tg040 on February 12, 2020, 05:06:03 PM
When going to ftp accounts under the user account cwp (reports/?module=ftp_accounts), the list of accounts is stuck and loading forever. Does anyone know how to solve it?

I have the same issue

rcschaff

Just looked into it.   Bug in the module:   
jquery-3.1.1.min.js:2 jQuery.Deferred exception: Cannot read property 'forEach' of null TypeError: Cannot read property 'forEach' of null
    at listFTP (https://server3.schaffner.org:2083/cwp_8cebff215234c501/schaffne/?module=ftp_accounts:3056:12)
    at HTMLDocument.<anonymous> (https://server3.schaffner.org:2083/cwp_8cebff215234c501/schaffne/?module=ftp_accounts:3049:3)
    at j (https://server3.schaffner.org:2083/schaffne/cwp_theme/original/js/jquery-3.1.1.min.js:2:29948)
    at k (https://server3.schaffner.org:2083/schaffne/cwp_theme/original/js/jquery-3.1.1.min.js:2:30262) undefined
r.Deferred.exceptionHook @ jquery-3.1.1.min.js:2
k @ jquery-3.1.1.min.js:2
setTimeout (async)
(anonymous) @ jquery-3.1.1.min.js:2
i @ jquery-3.1.1.min.js:2
fireWith @ jquery-3.1.1.min.js:2
fire @ jquery-3.1.1.min.js:2
i @ jquery-3.1.1.min.js:2
fireWith @ jquery-3.1.1.min.js:2
ready @ jquery-3.1.1.min.js:2
R @ jquery-3.1.1.min.js:3
jquery-3.1.1.min.js:2 Uncaught TypeError: Cannot read property 'forEach' of null
    at listFTP (?module=ftp_accounts:3056)
    at HTMLDocument.<anonymous> (?module=ftp_accounts:3049)
    at j (jquery-3.1.1.min.js:2)
    at k (jquery-3.1.1.min.js:2)
Google Hangouts:  rcschaff82@gmail.com

rcschaff

Workaround for those bold enough:

1)  nano /usr/local/cwpsrv/var/services/users/cwp_theme/original/js/jsfix.php
<?php
$user 
= $_GET['user'];
$data = array("key" => "","action"=>'list',"user"=>"{$user}");
$url = "https://LOCALHOST:2302/v1/ftpaccount";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt ($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt ($ch, CURLOPT_POST, 1);
$response = curl_exec($ch);
curl_close($ch);
$vars = json_decode($response);
$js = "[";
foreach(
$vars->userftp as $key => $value) {
$vals = explode("\t",$value);
#var_dump($vals);
$val = explode("@",$vals[0]);
#var_dump($val);
if ($val[0] != "") {
$js .= "{\"username\":\"".$val[0]."\",\"domain\":\"".$val[1]."\",\"path\":\"".$vals[1]."\"},";
}
}
$js = rtrim($js,",");
$js .= "]";
$js = str_replace("/","\/",$js);
echo 
$js;
?>



Step 2:
nano /usr/local/cwpsrv/var/services/users/cwp_theme/original/js/modules/ftp_accounts.js.twig
At the very top of the file is "let ftp_list = JSON.parse('{{mod.ftp_account_list|json_encode|raw}}');"

Replace with below
// CECILIO MORALES JS
$.ajaxSetup({
  async: false
});
$.get( "/cwp_theme/original/js/jsfix.php", { user: "{{users}}" } )
  .done(function( data ) {
     ftp_listdata = data;
  });
let ftp_list = JSON.parse(ftp_listdata);
//let ftp_list = JSON.parse('{{mod.ftp_account_list|json_encode|raw}}');
Google Hangouts:  rcschaff82@gmail.com


tmadwar

First i would like to thank you for the nice fix,

What you have fixed is the screen to list available accounts for current user, and yes it is fixed , Thanks :)

But creating a new user, or deleting existing one, still takes forever and not processed :(

Any other update we can do Please ?

rcschaff

If i were part of the Dev team, it would already be fixed.  Unfortunately, I'm just another user with development skills.  If they hadn't encrypted the project, I could probably do it, but as that is not the case, I can only do workaround.  I'll see what I can do tomorrow about a workaround for adding/deleting. ;)
Google Hangouts:  rcschaff82@gmail.com

Sandeep

hi this should be fixed on coming version the dev files are created and we're testing it before release.