Jump to content

How to create customer login in JS with api / webservice


Wrandy4

Recommended Posts

Hi everyone,

I try to create my app, using Angular 4 and Ionic. My api is fully set, I can get product, combination and other.

Now I try to create a login form. For doing this, I get a email and plaintext password. I try to crypt the password, matching to prestashop customer's db password. But I can't.

My request look like :

http://localhost/prestatest/api/customers/?&output_format=JSON&ws_key=MY_KEY&filter=mail&filter[passwd]=passwd

But I always get an empty array : "[]"

My prestashop version is 1.7.2.x

How to do the crypt function in JS please ?

 

Thanks for reply

Link to comment
Share on other sites

Hi Wrandy

I just stumbled on your topic by deleting that spam. 

But not sure if I can help you with your problem, but maybe you could try bit different approach.

So first, is there a typo in your request ? filter=mail ( filter=email) ? Maybe I ask silly question.

But other approach is to filter just by email, that should return customer and compare passwd from form and

from database ?

Check this link maybe you will find something useful. 

http://forge.prestashop.com/browse/BOOM-4406

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi Razaro !
Thanks for reply. Yep, I already found the solution you suggested. The problem is to find the crypting algorythm in JS. If I use your solution, I need to send a plaintext password to a server. Server crypt and try it, only because it's a php crypting solution.

I use this solution to dev. and if I couId find an other solution it will b better. I am planning to use my own crypting solution between  JS client and PHP server in order to retrieve the plaintext password before the function "password_verify()".

 

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