creat account: ask for password twice

Home Forums Legacy Support Support queries Setup issues creat account: ask for password twice

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #166644
    MeesterGijs
    Spectator
    Hello, 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?
    #166750
    Mark Morgan
    Spectator
    Hello, 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' ); } } }
    #166917
    MeesterGijs
    Spectator
    I 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, Gijs
    #167018
    Anshuman Sahu
    Keymaster
    Please 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' );         }     }   }
    #167056
    MeesterGijs
    Spectator
    It 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?
    #167205
    Mark Morgan
    Spectator
    Sorry, this is not available.
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘creat account: ask for password twice’ is closed to new replies.