Jump to content

programmatical login in prestashop


Peter Berghuis

Recommended Posts

hello prestashop community!

im a beginer on prestashop but have worked with other cms's like wordpress and joomla but i have some difficulties with your login.

I have the login and password, but when i post these to the authenticator controller in ajax, nothing happens, it doesn't log me in even though i pass the 3 required parameters of 'email', 'password', 'submitLogin' and 'back'.

I have no other choise then to do this login using ajax post method because it should be done seemingly without the need of a user retyping his login and password.

here is some code:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<meta name="_csrf" content="${_csrf.token}"/>
<meta name="_csrf_header" content="${_csrf.headerName}"/>

<script>
 $( document ).ready(function() {
  $.post('index.php?controller=authentication', { back: 'my-account', email: '[email protected]', password : 'test1234', SubmitLogin: 1}, 
    function(returnedData){
      console.log(returnedData);
    })
    .fail(function(){
      console.log("error");
    });
 });
</script>

However the response of the ajax corresponds to the login page without any particular error message.

Would anyone have any idea why it doesn't log us in?

 

 

Link to comment
Share on other sites

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...