Jump to content

[backoffice] autologin via javascript


a17000

Recommended Posts

Hi all,

I use the prestashop's backoffice via my CRM (Sugarcrm), I have made a module vhose show the prestashop backoffice in a iframe.

<iframe id="frameprestashopacacia" width="100%" height="650"></iframe>
<script type="text/javascript">
    
	
    var iframe = document.getElementById('frameprestashopacacia');
	iframe.src = "http://192.168.1.12/prestashop/admin070lursxx";
	var une_fois = true;
    iframe.onload = function() {
		if (une_fois){
			une_fois = false;
			//iframe.getElementById('email').value= "[email protected]";
			iframe.contentWindow.document.getElementById('email').value= "myemaillogin";
			iframe.contentWindow.document.getElementById('passwd').value= "mypassword";
			iframe.contentWindow.document.getElementById('login_form').submit();
		} 

    }
	
</script> 

But when 'getElementById('login_form').submit();' is fired the page reload, why?
And How to login to this page without click manually all the time?

 

Thanks,

Link to comment
Share on other sites

Joking or not?

 

Never code user names or passwords into a file - even if the file seems not to be public.

 

The cause of the reload is the embedded frame. The frame has a fixed source. It's not updated after you log on.

Link to comment
Share on other sites

  • 6 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...