febc70dd by Jeff Balicki

Register

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 179502c4
......@@ -14654,6 +14654,10 @@ input[type=checkbox] {
line-height: 34px !important;
}
.woocommerce-form-register .error {
color: red;
}
.pre-header {
background-color: #0484b8;
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(){
function wooc_extra_register_fields() {?>
<p class="form-row form-row-first">
<label for="reg_billing_first_name"><?php _e( 'First name', 'woocommerce' ); ?><span class="required">*</span></label>
<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'] ); ?>" />
<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'] ); ?>" />
</p>
<p class="form-row form-row-last">
<label for="reg_billing_last_name"><?php _e( 'Last name', 'woocommerce' ); ?><span class="required">*</span></label>
<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'] ); ?>" />
<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'] ); ?>" />
</p>
<div class="clear"></div>
<?php
......@@ -180,18 +180,22 @@ function wooc_save_extra_register_fields( $customer_id ) {
}
add_action( 'woocommerce_created_customer', 'wooc_save_extra_register_fields' );
add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3);
// ----- validate password match on the registration page
function registration_errors_validation($reg_errors, $sanitized_user_login, $user_email) {
global $woocommerce;
extract( $_POST );
if ( strcmp( $password, $password2 ) !== 0 ) {
return new WP_Error( 'registration-error', __( 'Passwords do not match.', 'woocommerce' ) );
}
return $reg_errors;
}
add_filter('woocommerce_registration_errors', 'registration_errors_validation', 10,3);
add_action( 'woocommerce_register_form', 'wc_register_form_password_repeat' );
// ----- add a confirm password fields match on the registration page
function wc_register_form_password_repeat() {
?>
<p class="form-row form-row-wide">
......@@ -200,4 +204,33 @@ function wc_register_form_password_repeat() {
</p>
<?php
}
?>
\ No newline at end of file
add_action( 'woocommerce_register_form', 'wc_register_form_password_repeat' );
// ----- Validate confirm password field match to the checkout page
function lit_woocommerce_confirm_password_validation( $posted ) {
$checkout = WC()->checkout;
if ( ! is_user_logged_in() && ( $checkout->must_create_account || ! empty( $posted['createaccount'] ) ) ) {
if ( strcmp( $posted['account_password'], $posted['account_confirm_password'] ) !== 0 ) {
wc_add_notice( __( 'Passwords do not match.', 'woocommerce' ), 'error' );
}
}
}
add_action( 'woocommerce_after_checkout_validation', 'lit_woocommerce_confirm_password_validation', 10, 2 );
// ----- Add a confirm password field to the checkout page
function lit_woocommerce_confirm_password_checkout( $checkout ) {
if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) {
$fields = $checkout->get_checkout_fields();
$fields['account']['account_confirm_password'] = array(
'type' => 'password',
'label' => __( 'Confirm password', 'woocommerce' ),
'required' => true,
'placeholder' => _x( 'Confirm Password', 'placeholder', 'woocommerce' )
);
$checkout->__set( 'checkout_fields', $fields );
}
}
add_action( 'woocommerce_checkout_init', 'lit_woocommerce_confirm_password_checkout', 10, 1 );
\ No newline at end of file
......
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 @@
"jquery": ">=1.4.2 <4"
}
},
"jquery-validation": {
"version": "1.19.5",
"resolved": "https://registry.npmjs.org/jquery-validation/-/jquery-validation-1.19.5.tgz",
"integrity": "sha512-X2SmnPq1mRiDecVYL8edWx+yTBZDyC8ohWXFhXdtqFHgU9Wd4KHkvcbCoIZ0JaSaumzS8s2gXSkP8F7ivg/8ZQ=="
},
"js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
......
......@@ -51,6 +51,7 @@
"isotope": "^1.0.0-alpha.3",
"isotope-layout": "^3.0.6",
"jquery-bridget": "^3.0.1",
"jquery-validation": "^1.19.5",
"jssocials": "^1.5.0",
"rollup-plugin-postcss": "^4.0.2",
"swiper": "^8.4.7"
......
......@@ -2,6 +2,8 @@ import jQuery from 'jquery';
import jQueryBridget from 'jquery-bridget';
import Isotope from "isotope-layout";
import DataTable from 'datatables.net-bs5';
import validate from 'jquery-validation';
jQueryBridget( 'isotope', Isotope, $ );
......@@ -87,6 +89,34 @@ $('#navbarNavDropdown').prepend($search);
});
$('.register').attr('id','register');
$("#register").validate({
// Specify validation rules
rules: {
billing_first_name: {
required: true,
},
billing_last_name:{
required: true,
},
email: {
required: true,
email: true
},
password: {
required: true,
minlength: 10
},
password2: {
required: true,
minlength: 10,
equalTo: "#reg_password"
}
},
});
});
......
......@@ -181,3 +181,8 @@ background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/s
.has-medium-font-size{
line-height: 34px !important;
}
.woocommerce-form-register{
.error{
color: red;
}
}
\ No newline at end of file
......
......@@ -5,7 +5,7 @@
Author: Tenzing Communications
Author URI: https://tenzingbrand.com
Template: understrap
Version: 1.1.002
Version: 1.1.003
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: understrap-child
......