Jump to content
  • разработка интернет магазинов на opencart
  • доработка интернет магазинов на opencart

Ошибка авторизации


Recommended Posts

добрый гдень. На данный момент суещёствует несколько проблем сыязанных с попыткой авторизоваться

2021-12-27 10:57:51 - PHP Notice:  Undefined index: email in /home/***/***/catalog/controller/account/login.php on line 133
2021-12-27 10:57:51 - PHP Notice:  Undefined index: email in /home/***/***/catalog/controller/account/login.php on line 140
 

С чем может быть связана данная проблема?

 

Сама функция:

public function login()
    {
        $json = array();
 
        $this->load->language('account/login');
 
        $this->load->model('account/customer');
 
        // Check how many login attempts have been made.
        $login_info = $this->model_account_customer->getLoginAttempts($this->request->post['email']);
 
        if ($login_info && ($login_info['total'] >= $this->config->get('config_login_attempts')) && strtotime('-1 hour') < strtotime($login_info['date_modified'])) {
            $json['error'] = $this->language->get('error_attempts');
        }
 
        // Check if customer has been approved.
        $customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);
 
        if ($customer_info && !$customer_info['status']) {
            $json['error'] = $this->language->get('error_approved');
        }
 
        if (!$json) {
            if (!$this->customer->login($this->request->post['email'], $this->request->post['password'])) {
                $json['error'] = $this->language->get('error_login');
 
                $this->model_account_customer->addLoginAttempt($this->request->post['email']);
            } else {
                $this->model_account_customer->deleteLoginAttempts($this->request->post['email']);
            }
        }
 
        if (!$json) {
            // Unset guest
            unset($this->session->data['guest']);
 
            // Default Shipping Address
            $this->load->model('account/address');
 
            if ($this->config->get('config_tax_customer') == 'payment') {
                $this->session->data['payment_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
            }
 
            if ($this->config->get('config_tax_customer') == 'shipping') {
                $this->session->data['shipping_address'] = $this->model_account_address->getAddress($this->customer->getAddressId());
            }
 
            // Wishlist
            if (isset($this->session->data['wishlist']) && is_array($this->session->data['wishlist'])) {
                $this->load->model('account/wishlist');
 
                foreach ($this->session->data['wishlist'] as $key => $product_id) {
                    $this->model_account_wishlist->addWishlist($product_id);
 
                    unset($this->session->data['wishlist'][$key]);
                }
            }
 
            $json['redirect'] = $this->url->link('common/home', '', true);
        }
 
        $this->response->addHeader('Content-Type: application/json');
        $this->response->setOutput(json_encode($json));
    }

 

Строки 133 и 140

$login_info = $this->model_account_customer->getLoginAttempts($this->request->post['email']);
 
140
$customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']);
Edited by mixail_88
Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.