Home › Forums › Legacy Support › Support queries › Setup issues › creat account: ask for password twice
Tagged: checkout, password, profile, registration
- This topic has 5 replies, 3 voices, and was last updated 6 years, 6 months ago by Mark Morgan.
Viewing 6 posts - 1 through 6 (of 6 total)
-
AuthorPosts
-
June 21, 2018 at 1:02 pm #166644MeesterGijsSpectatorHello, http://metmeestergijs.nl/checkout/ is my checkout page where users register. (See screenshot). I use the regular registration fields from wp-admin/user/profile fields. But I miss what you often see: asking twice (two times) for a password. Is that possible?June 22, 2018 at 10:33 am #166750Mark MorganSpectatorHello, Please add the below given php code in your wplms-customizer plugin -> wplms-customizer.php. add_action( 'woocommerce_checkout_init', 'wc_add_confirm_password_checkout', 10, 1 ); function wc_add_confirm_password_checkout( $checkout ) { if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) { $checkout->checkout_fields['account']['account_password2'] = array( 'type' => 'password', 'label' => __( 'Verify password', 'woocommerce' ), 'required' => true, 'placeholder' => _x( 'Password', 'placeholder', 'woocommerce' ) ); } } // Check the password and confirm password fields match before allow checkout to proceed. add_action( 'woocommerce_after_checkout_validation', 'wc_check_confirm_password_matches_checkout', 10, 2 ); function wc_check_confirm_password_matches_checkout( $posted ) { $checkout = WC()->checkout; if ( ! is_user_logged_in() && ( $checkout->must_create_account || ! empty( $posted['createaccount'] ) ) ) { if ( strcmp( $posted['account_password'], $posted['account_password2'] ) !== 0 ) { wc_add_notice( __( 'Passwords do not match.', 'woocommerce' ), 'error' ); } } }June 24, 2018 at 2:11 pm #166917MeesterGijsSpectatorI did add the code to the customizer plugin, but it didn't do anything. I checked all places for a possible added option that I have to activate, or for an extra checkout field on my checkout page, but I couldn't find anything. Can you help me with this? When creating a new account it does say that passwords (plural!) don't match (screenshot). But I see only one field to add password. Does it have to do with custom code? Kind regards, GijsJune 25, 2018 at 1:14 pm #167018Anshuman SahuKeymasterPlease remove previous one and add this code in your wplms-customizer.php file in wplms customizer plugin : add_filter( 'woocommerce_checkout_fields', 'wc_add_confirm_password_checkout', 10, 1 ); function wc_add_confirm_password_checkout( $checkout_fields ) { if ( get_option( 'woocommerce_registration_generate_password' ) == 'no' ) { $checkout_fields['account']['account_password2'] = array( 'type' => 'password', 'label' => __( 'Confirm password', 'woocommerce' ), 'required' => true, 'placeholder' => _x( 'Confirm Password', 'placeholder', 'woocommerce' ) ); } return $checkout_fields; } // Check the password and confirm password fields match before allow checkout to proceed. add_action( 'woocommerce_after_checkout_validation', 'wc_check_confirm_password_matches_checkout', 10, 2 ); function wc_check_confirm_password_matches_checkout( $posted ) { $checkout = WC()->checkout; if ( ! is_user_logged_in() && ( $checkout->must_create_account || ! empty( $posted['createaccount'] ) ) ) { if ( strcmp( $posted['account_password'], $posted['account_password2'] ) !== 0 ) { wc_add_notice( __( 'Passwords do not match.', 'woocommerce' ), 'error' ); } } }June 25, 2018 at 6:58 pm #167056MeesterGijsSpectatorIt worked. But is it possible to add option to see what you have typed or at least get notification that what you type the second time is the same password as what you typed the first time?June 26, 2018 at 1:43 pm #167205Mark MorganSpectatorSorry, this is not available.
-
AuthorPosts
Viewing 6 posts - 1 through 6 (of 6 total)
- The topic ‘creat account: ask for password twice’ is closed to new replies.