Ejemplo n.º 1
0
 /**
  * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer
  *
  * @return \Generated\Shared\Transfer\CustomerResponseTransfer
  */
 public function hasCustomerWithEmailAndPasswordAction(CustomerTransfer $customerTransfer)
 {
     $isAuthorized = $this->getFacade()->tryAuthorizeCustomerByEmailAndPassword($customerTransfer);
     $result = new CustomerResponseTransfer();
     if ($isAuthorized === true) {
         $result->setCustomerTransfer($this->getFacade()->getCustomer($customerTransfer));
     }
     $result->setHasCustomer($isAuthorized);
     $this->setSuccess($isAuthorized);
     return $result;
 }
Ejemplo n.º 2
0
 /**
  * @param \Orm\Zed\Customer\Persistence\SpyCustomer $customerEntity
  * @param \Generated\Shared\Transfer\CustomerTransfer $customerTransfer
  *
  * @return \Generated\Shared\Transfer\CustomerResponseTransfer
  */
 protected function getCustomerPasswordInvalidResponse(SpyCustomer $customerEntity, CustomerTransfer $customerTransfer)
 {
     $customerResponseTransfer = new CustomerResponseTransfer();
     $customerResponseTransfer->setIsSuccess(true);
     if (!$this->isValidPassword($customerEntity->getPassword(), $customerTransfer->getPassword())) {
         $customerErrorTransfer = new CustomerErrorTransfer();
         $customerErrorTransfer->setMessage(Messages::CUSTOMER_PASSWORD_INVALID);
         $customerResponseTransfer->setIsSuccess(false)->addError($customerErrorTransfer);
     }
     return $customerResponseTransfer;
 }