Control Web Panel

WebPanel => CentOS-WebPanel Bugs => Topic started by: tg040 on February 12, 2020, 05:06:03 PM

Title: ftp accounts not showing created accounts (stuck) from user cwp
Post by: 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?
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: rcschaff 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.
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: tg040 on February 12, 2020, 05:37:11 PM
pureftp has an error log? do you know where? thank you for your suggestion.
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: tg040 on February 12, 2020, 05:39:08 PM
nevermind. i found the apache error log.
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: tg040 on February 12, 2020, 05:41:50 PM
nothing on the logs.
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: rcschaff on February 12, 2020, 06:15:31 PM
Centos runs on nginx  /usr/local/cwpsrv/logs/error_log
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: tg040 on February 12, 2020, 06:23:55 PM
nothing there too. thanks for the tip. never looked at this log file. some interesting stuff.
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: royer_guerra@hotmail.com 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
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: rcschaff 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)
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: rcschaff 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}}');
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: hmmatos on February 14, 2020, 03:24:10 PM
Thanks rcschaff,

it worked  :)
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: tmadwar 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 ?
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: rcschaff 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. ;)
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: Sandeep 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.
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: Gsk on February 20, 2020, 11:59:43 AM
Any update?!
Title: Re: ftp accounts not showing created accounts (stuck) from user cwp
Post by: Sandeep on February 20, 2020, 02:59:26 PM
kindly update your cwp new update released.