I am trying to use auto login with the method detailed here on howtoforge FORUM, which is used successfully by users, but I am not able to get it work. I have tried both alternatives without any luck HTML: <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.js"></script> <form name="ajaxform" id="ajaxform" method="POST" > <input type="hidden" name="s_mod" value="login"> <input type="hidden" name="s_pg" value="index"> <input name="username" id="username" value="" size="30" maxlength="255" type="text"> <input name="passwort" id="passwort" value="" size="30" maxlength="255" type="password"> <button type="submit" class="button" value="" ><span>Anmelden</span></button> </form> <script type="text/javascript"> //callback handler for form submit $("#ajaxform").submit(function() { var postData = $(this).serializeArray(); $.ajax({ url : 'https://isp.tld:8080/content.php', type: "POST", data : postData, xhrFields: {withCredentials: true}, success:function(){ window.location.replace("https://isp.tld:8080/index.php"); } }); return false; }); </script> and this one Code: <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.js"></script> <script type="text/javascript"> function weiterleitung() { $.ajax({ type: "post", url: "https://isp.tld:8080/content.php", data: "s_mod=login&s_pg=index&username=USERNAME&passwort=PASSWORD", xhrFields: {withCredentials: true} }).done(function(){location.href='https://isp.tld:8080/index.php'}); } window.setTimeout("weiterleitung()", 100); </script> I have edit the ispconfig.inc.local.php PHP: <?phpheader('Access-Control-Allow-Origin: *'); header('Access-Control-Allow-Methods: POST'); header('Access-Control-Allow-Credentials: true'); I have replaced the URL, username, password wherever required. is there some change in the mechanism for ISPCONFIG 3.1? or I am just missing something.
Hi Till, I have updated to Code: $.ajax({ url : 'https://server1.mywebsolutions.co.in:8080/login/index.php', Now the page is being redirected to 'https://server1.mywebsolutions.co.in:8080/login but the user is not logged in. It stays at login screen.
I don't have an autlogin script for ISPConfig 3.1. You might ask the original developers of that script if they like to develop one.
Thanks Till, I somehow managed to get it working. I am putting it below, if it might help someone. Code: success:function(){ window.location.replace("https://isp.tld:8080/index"); } That is removing the .php extension from index.php worked for me.
The original author was member LKTechnik and his script only works with pre-3.1 ispconfig. I have tried to reach him but he has not been on the forum since 2015. I tried your suggestion and it does not work for me. I use the second script for autologin from a master cp. Didn't realize how much I used it until it was gone when I upgraded to 3.1.
I don't know where you are facing the problem, but for me I have tested the first script the form one and it works fine. The second script also I have tested which is included in ISPCFG server module for WHMCS, which is also working OK. Try to make these changes if these works if you are using the second script. Code: url: "https://isp.tld:8080/content.php", to Code: url: "https://isp.tld:8080/login/index.php", and Code: }).done(function(){location.href='https://isp.tld:8080/index.php'}); to Code: }).done(function(){location.href='https://isp.tld:8080/index'}); Hope this helps.
When I try it exactly as you have it the error I get is as below. Not Found The requested URL /index was not found on this server. Wonder if anyone else using this auto login script has got it workingunder 3.1. Anyone? Thanks!
There is no such url /index in ispconfig, so not sure why it works for you. This URL has not changed, so try to leave it at index.php.
I am not sure Till. But now leaving at index.php is also working in both the cases. Therefore what I have omitted which caused it not to work, I can't find it. But it is working for me whether I am using only index or index.php.
Hi Till, I have the script working, but at times, when using redirect link for login, the page stays at login screen, but if refresh the page, I get the dashboard. Subsequently if I try the link I always get the dashboard. But if there is enough duration between between the auto-login attempt, it happens that instead of getting me logged in, I get the login screen, but on refresh the dashboard. This the full script I am using is like this: PHP: function ispcfg3_ClientArea( $params ) { $soapsvrurl = $params['configoption3']; $soapsvrssl = $params['configoption4']; if ( $soapsvrssl == 'on' ) { $soapsvrurl = 'https://' . $soapsvrurl . ''; } else { $soapsvrurl = 'http://' . $soapsvrurl . ''; } $code = ' <form id="frmIspconfigLogin" action="'.$soapsvrurl.'/index.php" method="GET" target="_blank"> <button type="submit" class="btn btn-xs btn-success">CONTROLPANEL LOGIN</button> </form> <script type="text/javascript"> $("#frmIspconfigLogin").submit(function(){ $.ajax({ type: "POST", url: "'.$soapsvrurl.'/login/index.php", data: "s_mod=login&s_pg=index&username='.$params['username'].'&password='.$params['password'].'", xhrFields: {withCredentials: true} }); }); </script>'; return $code;} Can you give some direction, where it might be corrected?
Maybe the problem is related to session timeouts. Have you tried to set the session duration to unlimited (until browser window gets closed) in ispconfig under System > interface config?
pawan, This works: Code: $code = "<iframe id=\"ispcLogout\" style=\"visibility: hidden; height: 0; width: 0; \" src=\"$soapsvrurl/login/logout.php\"></iframe>"; $code .= ' <form id="frmIspconfigLogin" action="'.$server_url.'/index.php" method="GET" target="_blank"> <button type="submit" class="btn btn-xs btn-success">CONTROLPANEL LOGIN</button> </form><P></p> <script type="text/javascript"> $("#frmIspconfigLogin").submit(function(){ $.ajax({ type: "POST", url: "'.$server_url.'/login/index.php", data: "s_mod=login&s_pg=index&username='.$params['username'].'&password='.$params['password'].'", xhrFields: {withCredentials: true} }); }); </script>'; return $code;