-
Notifications
You must be signed in to change notification settings - Fork 5
fix seopro and check not empty email #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,13 +31,14 @@ | |||||||||
| url: 'index.php?route=extension/dashboard/chart_by_country_and_region/chartByCountry&user_token={{ user_token }}', | ||||||||||
| dataType: 'json', | ||||||||||
| success: function(json) { | ||||||||||
| if(json.data.length > 1) { | ||||||||||
| data = json.data || 0; | ||||||||||
|
||||||||||
| data = json.data || 0; | |
| data = json.data || []; |
Copilot
AI
Jan 28, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable data is declared without const, let, or var, making it an implicit global variable. This can lead to unintended side effects and conflicts with other code. Declare it with const or let to properly scope the variable.
| data = json.data || 0; | |
| const data = json.data || 0; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -69,7 +69,7 @@ public function index() { | |
| } | ||
|
|
||
| protected function validate() { | ||
| if (!isset($this->request->post['email'])) { | ||
| if (!isset($this->request->post['email']) || !trim($this->request->post['email'])) { | ||
|
||
| $this->error['warning'] = $this->language->get('error_email'); | ||
| } elseif (!$this->model_account_customer->getTotalCustomersByEmail($this->request->post['email'])) { | ||
| $this->error['warning'] = $this->language->get('error_email'); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -472,6 +472,8 @@ private function getKeywordByQuery($query, $language_id = null) { | |
| } | ||
|
|
||
| public function validate() { | ||
| $this->detectAjax(); | ||
|
||
|
|
||
| if (php_sapi_name() === 'cli') { | ||
| return; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After checking that the email is not empty with
trim(), the subsequent code still uses the untrimmed email value$this->request->post['email']on lines 21, 68. This means that an email with leading/trailing whitespace would pass the empty check, but downstream code would still receive the email with whitespace. Consider trimming the email value once at the beginning of the validation method and storing it in a variable, or trim it before using it in database queries.