Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Checkout user password validation fix for create new user

givanze9707ffac9c4
diff --git a/app/controller/checkout/checkout.php b/app/controller/checkout/checkout.php
index 47714fe..2e9f62c 100755
--- a/app/controller/checkout/checkout.php
+++ b/app/controller/checkout/checkout.php
@@ -142,7 +142,7 @@ class Checkout extends Base {
if (! $this->global['user_id']) {
//password is provided
if (isset($this->request->post['register']) && $this->request->post['register'] == 'true') {
- $rules[] = 'signup';
+ $rules[] = 'checkout_signup';
} else {
$rules[] = 'guest';
}
@@ -200,7 +200,6 @@ class Checkout extends Base {
}
}
- unset($rules['confirm_password']);
$validator = new Validator($rules);
$checkoutInfo = $validator->filter($this->request->post);
diff --git a/app/template/components/checkout/payment.tpl b/app/template/components/checkout/payment.tpl
index 3a258fa..9a0433c 100755
--- a/app/template/components/checkout/payment.tpl
+++ b/app/template/components/checkout/payment.tpl
@@ -26,6 +26,7 @@ if($payments && is_array($payments['payment'])) {
@payment img[data-v-payment-*]|src = $payment['@@__data-v-payment-(*)__@@']
+ @payment [data-v-payment-description]|innerText = <?php echo $payment['@@__data-v-payment-(*)__@@'];?>
@payment [data-v-payment-*]|innerText = $payment['@@__data-v-payment-(*)__@@']
@payment a[data-v-payment-*]|href = $payment['@@__data-v-payment-(*)__@@']
diff --git a/app/template/components/order.tpl b/app/template/components/order.tpl
index 870a6f6..a82274c 100755
--- a/app/template/components/order.tpl
+++ b/app/template/components/order.tpl
@@ -1,6 +1,6 @@
[data-v-component-order]|before = <?php
if (isset($order_idx)) $order_idx++; else $order_idx = 0;
-$order = $this->_component['orders'][$order_idx] ?? [];
+$order = $this->_component['order'][$order_idx] ?? [];
?>
@order-product = [data-v-component-order] [data-v-order-product]
diff --git a/app/validate/checkout_signup.php b/app/validate/checkout_signup.php
new file mode 100644
index 0000000..e5349de
--- /dev/null
+++ b/app/validate/checkout_signup.php
@@ -0,0 +1,41 @@
+<?php
+
+/**
+ * Vvveb
+ *
+ * Copyright (C) 2022 Ziadin Givan
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
+
+return [
+ 'first_name' => [
+ 'notEmpty' => '',
+ 'maxLength' => 100,
+ ],
+ 'last_name' => [
+ 'notEmpty' => '',
+ 'maxLength' => 100,
+ ],
+ 'email' => [
+ 'notEmpty' => '',
+ 'maxLength' => 100,
+ ],
+ 'password' => [
+ //'passwordComplexity' => 'low',
+ 'minLength' => 6,
+ 'maxLength' => 32,
+ ],
+];