$event =
new CustomerBeforeLoginEvent($context,
$email);
$this->eventDispatcher->
dispatch($event);
try { $customer =
$this->
getCustomerByEmail($email,
$context,
$includeGuest);
} catch (CustomerNotFoundException
$exception) { throw new UnauthorizedHttpException('json',
$exception->
getMessage());
} return $this->
loginByCustomer($customer,
$context);
} /**
* @throws BadCredentialsException
* @throws UnauthorizedHttpException
*/
public function loginById(string
$id, SalesChannelContext
$context): string
{ if (!Uuid::
isValid($id)) { throw CustomerException::
badCredentials();
}