Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. protected $customerSession;
  2. protected $urlInterface;
  3.  
  4. public function __construct(
  5. MagentoCustomerModelSession $customerSession,
  6. MagentoFrameworkUrlInterface $urlInterface,
  7. ...
  8. )
  9. {
  10. $this->urlInterface = $urlInterface;
  11. $this->customerSession = $customerSession;
  12. ...
  13. }
  14.  
  15. public function execute()
  16. {
  17. //Redirect to login page if customer is not logged in
  18. if(!$this->customerSession->isLoggedIn()) {
  19. $this->customerSession->setAfterAuthUrl($this->urlInterface->getCurrentUrl());
  20. $this->customerSession->authenticate();
  21. }
  22. ...
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement