diff --git a/Readme.md b/Readme.md
index 796ca83..3fce039 100755
--- a/Readme.md
+++ b/Readme.md
@@ -5,9 +5,11 @@
# PrestaShop REST API Module
Easily expose REST API endpoints for your Prestashop website. No configuration needed, just install and use it.
-## [Official Supported Version v4.5.1](https://addons.prestashop.com/en/website-performance/52062-rest-api-pro-version-with-fast-api-caching.html)
+## [Official Supported Version v5](https://addons.prestashop.com/en/website-performance/52062-rest-api-pro-version-with-fast-api-caching.html)
+New! Annotation-based API routing support added in version 5, July 2023.
## [Free Version v2.5](https://www.binshops.com/prestashop-api)
+For demo and testing, not recommended for production.
## The products that use this REST API
@@ -34,20 +36,23 @@ https://rest.binshops.com/rest/bootstrap
After installation access your API endpoints at: http://yourdomain.tld/rest.
### Why we need this API module? Is not Webservice API enough?
-You can get more info about this module: https://www.binshops.com/prestashop-rest-module
+You can get more info about this module: https://www.binshops.com/prestashop-api
### Documentation
You can access full documentation for REST endpoints on Postman publisher:
https://documenter.getpostman.com/view/1491681/TzkyP1UC
### How to write your API?
-You can easily write your API withing your existing a controller or a new one:
-**domain.tld/rest/yourmodule/yourcontroller**
-
-Read more: [Create REST API for PrestaShop modules](https://www.binshops.com/tutorial/create-rest-api-for-prestashop-modules)
-
-### Backward Compatibility
-If your shop is running on 1.7.6.x version of PrestaShop, please check the 1.7.6.x branch. The stable version supports latest Ps version.
+Annotation-based API routing added in v5.
+```php
+/**
+* @Route("/rest/get-products", name=”products”)
+*/
+public function getProducts()
+{
+// ...
+}
+```
### Required Modules
These native modules, which are already included in PrestaShop out of the box, are required to work with some endpoints.
diff --git a/controllers/front/accountedit.php b/controllers/front/accountedit.php
index 7473551..1d50568 100644
--- a/controllers/front/accountedit.php
+++ b/controllers/front/accountedit.php
@@ -65,6 +65,10 @@ protected function processPostRequest()
$success = false; $hasError = true;
$message = 'Password is not provided';
$messageCode = 303;
+ } elseif (!Validate::isAcceptablePasswordLength($password)) {
+ $success = false;
+ $message = "Invalid Password";
+ $messageCode = 304;
} elseif (empty($firstName)) {
$success = false; $hasError = true;
$message = "First name required";
diff --git a/controllers/front/login.php b/controllers/front/login.php
index 836435f..dd61e2f 100644
--- a/controllers/front/login.php
+++ b/controllers/front/login.php
@@ -40,18 +40,10 @@ protected function processPostRequest()
} elseif (empty($password)) {
$psdata = $this->trans('Password is not provided', [], 'Modules.Binshopsrest.Auth');
$messageCode = 303;
- $hasError = true;
- }
-
- if (!version_compare(_PS_VERSION_, '8.0', '>=')) {
- if (!Validate::isPasswd($password)) {
- $psdata = $this->trans("Invalid Password", [], 'Modules.Binshopsrest.Auth');
- $messageCode = 304;
- $hasError = true;
- }
- }
-
- if (!$hasError){
+ } elseif (!Validate::isAcceptablePasswordLength($password)) {
+ $psdata = $this->trans("Invalid Password", [], 'Modules.Binshopsrest.Auth');
+ $messageCode = 304;
+ } else {
Hook::exec('actionAuthenticationBefore');
$customer = new Customer();
$authentication = $customer->getByEmail(
diff --git a/controllers/front/register.php b/controllers/front/register.php
index 537f4d2..3b09535 100644
--- a/controllers/front/register.php
+++ b/controllers/front/register.php
@@ -36,7 +36,9 @@ protected function processPostRequest()
} elseif (!Validate::isEmail($email)) {
$psdata = $this->trans("Invalid email address", [], 'Modules.Binshopsrest.Auth');
$messageCode = 302;
- $hasError = true;
+ } elseif (!empty($password) && !Validate::isAcceptablePasswordLength($password)) {
+ $psdata = $this->trans("Invalid Password", [], 'Modules.Binshopsrest.Auth');
+ $messageCode = 304;
} elseif (empty($firstName)) {
$psdata = $this->trans("First name required", [], 'Modules.Binshopsrest.Auth');
$messageCode = 305;
diff --git a/controllers/front/resetpasswordenter.php b/controllers/front/resetpasswordenter.php
index cda692d..99f269e 100644
--- a/controllers/front/resetpasswordenter.php
+++ b/controllers/front/resetpasswordenter.php
@@ -77,6 +77,8 @@ protected function changePassword()
$this->psdata = $this->trans('The password and its confirmation do not match.', [], 'Shop.Notifications.Error');
}
+ if (!Validate::isAcceptablePasswordLength($passwd)) {
+ $this->psdata = $this->trans('The password is not in a valid format.', [], 'Shop.Notifications.Error');
if (version_compare(_PS_VERSION_, '8.0', '<=')) {
if (!Validate::isPasswd($passwd)) {
$this->psdata = $this->trans("Invalid Password", [], 'Modules.Binshopsrest.Auth');
diff --git a/views/templates/admin/configure.tpl b/views/templates/admin/configure.tpl
index 5166872..34b330c 100755
--- a/views/templates/admin/configure.tpl
+++ b/views/templates/admin/configure.tpl
@@ -15,7 +15,10 @@
{l s='Official Supported Version' mod='binshopsrest'}
- Get the latest supported version including the amazing features from Official PrestaShop Addons. Let's take a look at the list of benefits.
+ Get the latest supported version and documentation including the amazing features from Official PrestaShop Addons. Let's take a look at the list of benefits.
+
+
+ New! Annotation-based API routing added and structural changes made in version 5.