Author Topic: ftp accounts not showing created accounts (stuck) from user cwp  (Read 13729 times)

0 Members and 1 Guest are viewing this topic.

Offline
*
ftp accounts not showing created accounts (stuck) from user cwp
« 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?

Offline
****
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #1 on: February 12, 2020, 05:19:37 PM »
Check the error log.  Might be a file/system lock preventing access.  And timeout for cwpsrv is high.
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #2 on: February 12, 2020, 05:37:11 PM »
pureftp has an error log? do you know where? thank you for your suggestion.

Offline
*
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #3 on: February 12, 2020, 05:39:08 PM »
nevermind. i found the apache error log.

Offline
*
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #4 on: February 12, 2020, 05:41:50 PM »
nothing on the logs.

Offline
****
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #5 on: February 12, 2020, 06:15:31 PM »
Centos runs on nginx  /usr/local/cwpsrv/logs/error_log
Google Hangouts:  rcschaff82@gmail.com

Offline
*
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #6 on: February 12, 2020, 06:23:55 PM »
nothing there too. thanks for the tip. never looked at this log file. some interesting stuff.

Offline
*
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #7 on: February 12, 2020, 11:29:27 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

Offline
****
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #8 on: February 12, 2020, 11:42:48 PM »
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

Offline
****
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #9 on: February 13, 2020, 02:50:43 AM »
Workaround for those bold enough:

1)  nano /usr/local/cwpsrv/var/services/users/cwp_theme/original/js/jsfix.php
Code: [Select]
<?php
$user 
$_GET['user'];
$data = array("key" => "","action"=>'list',"user"=>"{$user}");
$url "https://LOCALHOST:2302/v1/ftpaccount";
$ch curl_init();
curl_setopt($chCURLOPT_URL$url);
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
curl_setopt($chCURLOPT_CUSTOMREQUEST"POST");
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
curl_setopt ($chCURLOPT_POSTFIELDShttp_build_query($data));
curl_setopt ($chCURLOPT_POST1);
$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
Code: [Select]
// 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

Offline
*
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #10 on: February 14, 2020, 03:24:10 PM »
Thanks rcschaff,

it worked  :)

Offline
*
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #11 on: February 16, 2020, 04:16:40 AM »
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 ?

Offline
****
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #12 on: February 16, 2020, 04:43:06 AM »
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

Offline
*****
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #13 on: February 16, 2020, 08:59:50 AM »
hi this should be fixed on coming version the dev files are created and we're testing it before release.

Offline
*
Re: ftp accounts not showing created accounts (stuck) from user cwp
« Reply #14 on: February 20, 2020, 11:59:43 AM »
Any update?!