0

I'm trying to make a login of a user externally in PHP.

Need to know which class should be used in Magento 2 to validate by Email & password and once validated, open the session.

I'm dealing with CustomerRepository Class, where there is a function that's supposed fetch a Customer by Email and returns a CustomerModel Object but no success. The idea is to get the Model from such user and in case the Model has data, get the password and compare.

$this->answer = $this->customer_Repository->get("pepe1@pepe.com");

When I print in console the answer, it's empty.

I do not find anything related to this topic. Is There any Class that makes this operation directly?

0

I believe Magento\Customer\Api\AccountManagementInterface::authenticate() method call will help you to validate email as well as password. You may also want to check implementation of the Magento\Customer\Controller\Account\LoginPost::execute() method and how session is prepared in case of success authentication.

  • I can not figure out how i can implement both, the Interface & class to make it work. I'm a little confused. – Apalabrados Feb 28 '16 at 19:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.