Register
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
15 changed files
with
86 additions
and
8 deletions
This diff is collapsed.
Click to expand it.
| ... | @@ -14654,6 +14654,10 @@ input[type=checkbox] { | ... | @@ -14654,6 +14654,10 @@ input[type=checkbox] { |
| 14654 | line-height: 34px !important; | 14654 | line-height: 34px !important; |
| 14655 | } | 14655 | } |
| 14656 | 14656 | ||
| 14657 | .woocommerce-form-register .error { | ||
| 14658 | color: red; | ||
| 14659 | } | ||
| 14660 | |||
| 14657 | .pre-header { | 14661 | .pre-header { |
| 14658 | background-color: #0484b8; | 14662 | background-color: #0484b8; |
| 14659 | color: #fff; | 14663 | color: #fff; | ... | ... |
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
| ... | @@ -134,11 +134,11 @@ function certs(){ | ... | @@ -134,11 +134,11 @@ function certs(){ |
| 134 | function wooc_extra_register_fields() {?> | 134 | function wooc_extra_register_fields() {?> |
| 135 | <p class="form-row form-row-first"> | 135 | <p class="form-row form-row-first"> |
| 136 | <label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?><span class="required">*</span></label> | 136 | <label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?><span class="required">*</span></label> |
| 137 | <input type="text" class="input-text" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" /> | 137 | <input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="billing_first_name" id="reg_billing_first_name" value="<?php if ( ! empty( $_POST['billing_first_name'] ) ) esc_attr_e( $_POST['billing_first_name'] ); ?>" /> |
| 138 | </p> | 138 | </p> |
| 139 | <p class="form-row form-row-last"> | 139 | <p class="form-row form-row-last"> |
| 140 | <label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?><span class="required">*</span></label> | 140 | <label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?><span class="required">*</span></label> |
| 141 | <input type="text" class="input-text" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" /> | 141 | <input type="text" class="woocommerce-Input woocommerce-Input--text input-text form-control" name="billing_last_name" id="reg_billing_last_name" value="<?php if ( ! empty( $_POST['billing_last_name'] ) ) esc_attr_e( $_POST['billing_last_name'] ); ?>" /> |
| 142 | </p> | 142 | </p> |
| 143 | <div class="clear"></div> | 143 | <div class="clear"></div> |
| 144 | <?php | 144 | <?php |
| ... | @@ -180,18 +180,22 @@ function wooc_save_extra_register_fields( $customer_id ) { | ... | @@ -180,18 +180,22 @@ function wooc_save_extra_register_fields( $customer_id ) { |
| 180 | } | 180 | } |
| 181 | add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' ); | 181 | add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' ); |
| 182 | 182 | ||
| 183 | add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3); | 183 | |
| 184 | |||
| 185 | |||
| 186 | |||
| 187 | // ----- validate password match on the registration page | ||
| 184 | function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) { | 188 | function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) { |
| 185 | global $woocommerce; | 189 | global $woocommerce; |
| 186 | extract( $_POST ); | 190 | extract( $_POST ); |
| 187 | |||
| 188 | if ( strcmp( $password, $password2 ) !== 0 ) { | 191 | if ( strcmp( $password, $password2 ) !== 0 ) { |
| 189 | return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) ); | 192 | return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) ); |
| 190 | } | 193 | } |
| 191 | return $reg_errors; | 194 | return $reg_errors; |
| 192 | } | 195 | } |
| 196 | add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3); | ||
| 193 | 197 | ||
| 194 | add_action( 'woocommerce_register_form', 'wc_register_form_password_repeat' ); | 198 | // ----- add a confirm password fields match on the registration page |
| 195 | function wc_register_form_password_repeat() { | 199 | function wc_register_form_password_repeat() { |
| 196 | ?> | 200 | ?> |
| 197 | <p class="form-row form-row-wide"> | 201 | <p class="form-row form-row-wide"> |
| ... | @@ -200,4 +204,33 @@ function wc_register_form_password_repeat() { | ... | @@ -200,4 +204,33 @@ function wc_register_form_password_repeat() { |
| 200 | </p> | 204 | </p> |
| 201 | <?php | 205 | <?php |
| 202 | } | 206 | } |
| 203 | ?> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 207 | add_action( 'woocommerce_register_form', 'wc_register_form_password_repeat' ); | ||
| 208 | |||
| 209 | // ----- Validate confirm password field match to the checkout page | ||
| 210 | function lit_woocommerce_confirm_password_validation( $posted ) { | ||
| 211 | $checkout = WC()->checkout; | ||
| 212 | if ( ! is_user_logged_in() && ( $checkout->must_create_account || ! empty( $posted['createaccount'] ) ) ) { | ||
| 213 | if ( strcmp( $posted['account_password'], $posted['account_confirm_password'] ) !== 0 ) { | ||
| 214 | wc_add_notice( __( 'Passwords do not match.', 'woocommerce' ), 'error' ); | ||
| 215 | } | ||
| 216 | } | ||
| 217 | } | ||
| 218 | add_action( 'woocommerce_after_checkout_validation', 'lit_woocommerce_confirm_password_validation', 10, 2 ); | ||
| 219 | |||
| 220 | // ----- Add a confirm password field to the checkout page | ||
| 221 | function lit_woocommerce_confirm_password_checkout( $checkout ) { | ||
| 222 | if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) { | ||
| 223 | |||
| 224 | $fields = $checkout->get_checkout_fields(); | ||
| 225 | |||
| 226 | $fields['account']['account_confirm_password'] = array( | ||
| 227 | 'type' => 'password', | ||
| 228 | 'label' => __( 'Confirm password', 'woocommerce' ), | ||
| 229 | 'required' => true, | ||
| 230 | 'placeholder' => _x( 'Confirm Password', 'placeholder', 'woocommerce' ) | ||
| 231 | ); | ||
| 232 | |||
| 233 | $checkout->__set( 'checkout_fields', $fields ); | ||
| 234 | } | ||
| 235 | } | ||
| 236 | add_action( 'woocommerce_checkout_init', 'lit_woocommerce_confirm_password_checkout', 10, 1 ); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
This diff is collapsed.
Click to expand it.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
| ... | @@ -3024,6 +3024,11 @@ | ... | @@ -3024,6 +3024,11 @@ |
| 3024 | "jquery": ">=1.4.2 <4" | 3024 | "jquery": ">=1.4.2 <4" |
| 3025 | } | 3025 | } |
| 3026 | }, | 3026 | }, |
| 3027 | "jquery-validation": { | ||
| 3028 | "version": "1.19.5", | ||
| 3029 | "resolved": "https://registry.npmjs.org/jquery-validation/-/jquery-validation-1.19.5.tgz", | ||
| 3030 | "integrity": "sha512-X2SmnPq1mRiDecVYL8edWx+yTBZDyC8ohWXFhXdtqFHgU9Wd4KHkvcbCoIZ0JaSaumzS8s2gXSkP8F7ivg/8ZQ==" | ||
| 3031 | }, | ||
| 3027 | "js-tokens": { | 3032 | "js-tokens": { |
| 3028 | "version": "4.0.0", | 3033 | "version": "4.0.0", |
| 3029 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", | 3034 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", | ... | ... |
| ... | @@ -51,6 +51,7 @@ | ... | @@ -51,6 +51,7 @@ |
| 51 | "isotope": "^1.0.0-alpha.3", | 51 | "isotope": "^1.0.0-alpha.3", |
| 52 | "isotope-layout": "^3.0.6", | 52 | "isotope-layout": "^3.0.6", |
| 53 | "jquery-bridget": "^3.0.1", | 53 | "jquery-bridget": "^3.0.1", |
| 54 | "jquery-validation": "^1.19.5", | ||
| 54 | "jssocials": "^1.5.0", | 55 | "jssocials": "^1.5.0", |
| 55 | "rollup-plugin-postcss": "^4.0.2", | 56 | "rollup-plugin-postcss": "^4.0.2", |
| 56 | "swiper": "^8.4.7" | 57 | "swiper": "^8.4.7" | ... | ... |
| ... | @@ -2,6 +2,8 @@ import jQuery from 'jquery'; | ... | @@ -2,6 +2,8 @@ import jQuery from 'jquery'; |
| 2 | import jQueryBridget from 'jquery-bridget'; | 2 | import jQueryBridget from 'jquery-bridget'; |
| 3 | import Isotope from "isotope-layout"; | 3 | import Isotope from "isotope-layout"; |
| 4 | import DataTable from 'datatables.net-bs5'; | 4 | import DataTable from 'datatables.net-bs5'; |
| 5 | import validate from 'jquery-validation'; | ||
| 6 | |||
| 5 | 7 | ||
| 6 | jQueryBridget( 'isotope', Isotope, $ ); | 8 | jQueryBridget( 'isotope', Isotope, $ ); |
| 7 | 9 | ||
| ... | @@ -87,6 +89,34 @@ $('#navbarNavDropdown').prepend($search); | ... | @@ -87,6 +89,34 @@ $('#navbarNavDropdown').prepend($search); |
| 87 | 89 | ||
| 88 | }); | 90 | }); |
| 89 | 91 | ||
| 92 | $('.register').attr('id','register'); | ||
| 93 | |||
| 94 | $("#register").validate({ | ||
| 95 | // Specify validation rules | ||
| 96 | rules: { | ||
| 97 | billing_first_name: { | ||
| 98 | required: true, | ||
| 99 | }, | ||
| 100 | billing_last_name:{ | ||
| 101 | required: true, | ||
| 102 | }, | ||
| 103 | email: { | ||
| 104 | required: true, | ||
| 105 | email: true | ||
| 106 | }, | ||
| 107 | password: { | ||
| 108 | required: true, | ||
| 109 | minlength: 10 | ||
| 110 | }, | ||
| 111 | password2: { | ||
| 112 | required: true, | ||
| 113 | minlength: 10, | ||
| 114 | equalTo: "#reg_password" | ||
| 115 | } | ||
| 116 | }, | ||
| 117 | |||
| 118 | }); | ||
| 119 | |||
| 120 | }); | ||
| 90 | 121 | ||
| 91 | 122 | ||
| 92 | }); | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -180,4 +180,9 @@ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/s | ... | @@ -180,4 +180,9 @@ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/s |
| 180 | } | 180 | } |
| 181 | .has-medium-font-size{ | 181 | .has-medium-font-size{ |
| 182 | line-height: 34px !important; | 182 | line-height: 34px !important; |
| 183 | } | ||
| 184 | .woocommerce-form-register{ | ||
| 185 | .error{ | ||
| 186 | color: red; | ||
| 187 | } | ||
| 183 | } | 188 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -5,7 +5,7 @@ | ... | @@ -5,7 +5,7 @@ |
| 5 | Author: Tenzing Communications | 5 | Author: Tenzing Communications |
| 6 | Author URI: https://tenzingbrand.com | 6 | Author URI: https://tenzingbrand.com |
| 7 | Template: understrap | 7 | Template: understrap |
| 8 | Version: 1.1.002 | 8 | Version: 1.1.003 |
| 9 | License: GNU General Public License v2 or later | 9 | License: GNU General Public License v2 or later |
| 10 | License URI: http://www.gnu.org/licenses/gpl-2.0.html | 10 | License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 11 | Text Domain: understrap-child | 11 | Text Domain: understrap-child | ... | ... |
-
Please register or sign in to post a comment