From d613f8a97cb537e0d8ea15bfefdff2bd68d894db Mon Sep 17 00:00:00 2001 From: Artem Serbulenko Date: Wed, 22 Jul 2026 23:15:43 +0300 Subject: [PATCH] valid input login --- upload/catalog/controller/account/login.php | 22 ++++++++++++-------- upload/catalog/controller/checkout/login.php | 4 ++++ 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/upload/catalog/controller/account/login.php b/upload/catalog/controller/account/login.php index 4464e7c3..2db5ea9d 100644 --- a/upload/catalog/controller/account/login.php +++ b/upload/catalog/controller/account/login.php @@ -160,18 +160,22 @@ public function index() { } protected function validate() { - // Check how many login attempts have been made. - $login_info = $this->model_account_customer->getLoginAttempts($this->request->post['email']); + if (!isset($this->request->post['email']) || !isset($this->request->post['password'])) { + $this->error['warning'] = $this->language->get('error_login'); + } else { + // 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'])) { - $this->error['warning'] = $this->language->get('error_attempts'); - } + if ($login_info && ($login_info['total'] >= $this->config->get('config_login_attempts')) && strtotime('-1 hour') < strtotime($login_info['date_modified'])) { + $this->error['warning'] = $this->language->get('error_attempts'); + } - // Check if customer has been approved. - $customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']); + // Check if customer has been approved. + $customer_info = $this->model_account_customer->getCustomerByEmail($this->request->post['email']); - if ($customer_info && !$customer_info['status']) { - $this->error['warning'] = $this->language->get('error_approved'); + if ($customer_info && !$customer_info['status']) { + $this->error['warning'] = $this->language->get('error_approved'); + } } if (!$this->error) { diff --git a/upload/catalog/controller/checkout/login.php b/upload/catalog/controller/checkout/login.php index c787eb95..3c17b2b8 100644 --- a/upload/catalog/controller/checkout/login.php +++ b/upload/catalog/controller/checkout/login.php @@ -32,6 +32,10 @@ public function save() { $json['redirect'] = $this->url->link('checkout/cart'); } + if (!isset($this->request->post['email']) || !isset($this->request->post['password'])) { + $json['error']['warning'] = $this->language->get('error_login'); + } + if (!$json) { $this->load->model('account/customer');