Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Login.php
Go to the documentation of this file.
1 <?php
7 
16 {
20  private $_username = -1;
21 
25  protected $_customerSession;
26 
30  protected $_customerUrl;
31 
38  public function __construct(
39  \Magento\Framework\View\Element\Template\Context $context,
40  \Magento\Customer\Model\Session $customerSession,
41  \Magento\Customer\Model\Url $customerUrl,
42  array $data = []
43  ) {
44  parent::__construct($context, $data);
45  $this->_isScopePrivate = false;
46  $this->_customerUrl = $customerUrl;
47  $this->_customerSession = $customerSession;
48  }
49 
53  protected function _prepareLayout()
54  {
55  $this->pageConfig->getTitle()->set(__('Customer Login'));
56  return parent::_prepareLayout();
57  }
58 
64  public function getPostActionUrl()
65  {
66  return $this->_customerUrl->getLoginPostUrl();
67  }
68 
74  public function getForgotPasswordUrl()
75  {
76  return $this->_customerUrl->getForgotPasswordUrl();
77  }
78 
84  public function getUsername()
85  {
86  if (-1 === $this->_username) {
87  $this->_username = $this->_customerSession->getUsername(true);
88  }
89  return $this->_username;
90  }
91 
97  public function isAutocompleteDisabled()
98  {
99  return (bool)!$this->_scopeConfig->getValue(
100  \Magento\Customer\Model\Form::XML_PATH_ENABLE_AUTOCOMPLETE,
101  \Magento\Store\Model\ScopeInterface::SCOPE_STORE
102  );
103  }
104 }
$customerUrl
Definition: info.phtml:28
__()
Definition: __.php:13
__construct(\Magento\Framework\View\Element\Template\Context $context, \Magento\Customer\Model\Session $customerSession, \Magento\Customer\Model\Url $customerUrl, array $data=[])
Definition: Login.php:38