| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- /**
- * Copyright © Magento, Inc. All rights reserved.
- * See COPYING.txt for license details.
- */
- namespace Magento\Customer\Block\Form;
- /**
- * Customer login form block
- *
- * @api
- * @author Magento Core Team <core@magentocommerce.com>
- * @since 100.0.2
- */
- class Login extends \Magento\Framework\View\Element\Template
- {
- /**
- * @var int
- */
- private $_username = -1;
- /**
- * @var \Magento\Customer\Model\Session
- */
- protected $_customerSession;
- /**
- * @var \Magento\Customer\Model\Url
- */
- protected $_customerUrl;
- /**
- * @param \Magento\Framework\View\Element\Template\Context $context
- * @param \Magento\Customer\Model\Session $customerSession
- * @param \Magento\Customer\Model\Url $customerUrl
- * @param array $data
- */
- public function __construct(
- \Magento\Framework\View\Element\Template\Context $context,
- \Magento\Customer\Model\Session $customerSession,
- \Magento\Customer\Model\Url $customerUrl,
- array $data = []
- ) {
- parent::__construct($context, $data);
- $this->_isScopePrivate = false;
- $this->_customerUrl = $customerUrl;
- $this->_customerSession = $customerSession;
- }
- /**
- * @return $this
- */
- protected function _prepareLayout()
- {
- $this->pageConfig->getTitle()->set(__('Customer Login'));
- return parent::_prepareLayout();
- }
- /**
- * Retrieve form posting url
- *
- * @return string
- */
- public function getPostActionUrl()
- {
- return $this->_customerUrl->getLoginPostUrl();
- }
- /**
- * Retrieve password forgotten url
- *
- * @return string
- */
- public function getForgotPasswordUrl()
- {
- return $this->_customerUrl->getForgotPasswordUrl();
- }
- /**
- * Retrieve username for form field
- *
- * @return string
- */
- public function getUsername()
- {
- if (-1 === $this->_username) {
- $this->_username = $this->_customerSession->getUsername(true);
- }
- return $this->_username;
- }
- /**
- * Check if autocomplete is disabled on storefront
- *
- * @return bool
- */
- public function isAutocompleteDisabled()
- {
- return (bool)!$this->_scopeConfig->getValue(
- \Magento\Customer\Model\Form::XML_PATH_ENABLE_AUTOCOMPLETE,
- \Magento\Store\Model\ScopeInterface::SCOPE_STORE
- );
- }
- }
|