| @@ -48,9 +48,9 @@ | ||
| 48 | 48 | * |
| 49 | 49 | */ |
| 50 | 50 | function wppb_create_recover_password_form( $user, $post_data, $is_ajax_form = false ){ |
| 51 | 51 | ?> |
| 52 | - <form enctype="multipart/form-data" method="post" id="wppb-recover-password" class="wppb-user-forms<?php echo ($is_ajax_form ? ' wppb-ajax-form' : ''); ?>" action="<?php echo esc_url( wppb_curpageurl() ); ?>"> | |
| 52 | + <form enctype="multipart/form-data" method="post" novalidate id="wppb-recover-password" class="wppb-user-forms<?php echo ($is_ajax_form ? ' wppb-ajax-form' : ''); ?>" action="<?php echo esc_url( wppb_curpageurl() ); ?>"> | |
| 53 | 53 | <ul> |
| 54 | 54 | <?php |
| 55 | 55 | |
| 56 | 56 | if( !empty( $post_data['passw1'] ) ) |
| @@ -109,9 +109,9 @@ | ||
| 109 | 109 | * |
| 110 | 110 | */ |
| 111 | 111 | function wppb_create_generate_password_form( $post_data, $is_ajax_form = false ){ |
| 112 | 112 | ?> |
| 113 | - <form enctype="multipart/form-data" method="post" id="wppb-recover-password" class="wppb-user-forms<?php echo ($is_ajax_form ? ' wppb-ajax-form' : ''); ?>" action="<?php echo esc_url( wppb_curpageurl() ); ?>"> | |
| 113 | + <form enctype="multipart/form-data" method="post" novalidate id="wppb-recover-password" class="wppb-user-forms<?php echo ($is_ajax_form ? ' wppb-ajax-form' : ''); ?>" action="<?php echo esc_url( wppb_curpageurl() ); ?>"> | |
| 114 | 114 | <?php |
| 115 | 115 | $wppb_generalSettings = get_option( 'wppb_general_settings' ); |
| 116 | 116 | |
| 117 | 117 | if( !empty( $wppb_generalSettings['loginWith'] ) && $wppb_generalSettings['loginWith'] == 'email' ){ |
| @@ -130,9 +130,9 @@ | ||
| 130 | 130 | |
| 131 | 131 | $recover_input = '<ul> |
| 132 | 132 | <li class="wppb-form-field wppb-username-email'. apply_filters( 'wppb_recover_field_extra_css_class', '', 'username_email') .'"> |
| 133 | 133 | <label for="username_email">'. esc_html( $username_email_label ) .'</label> |
| 134 | - <input class="text-input" name="username_email" type="text" id="username_email" value="'.esc_attr( trim( $username_email ) ).'" '. apply_filters( 'wppb_recover_password_extra_attr', '', esc_html( $username_email_label ), 'username_email' ) .' /> | |
| 134 | + <input class="text-input" name="username_email" type="text" id="username_email" value="'.esc_attr( trim( $username_email ) ).'" required '. apply_filters( 'wppb_recover_password_extra_attr', '', esc_html( $username_email_label ), 'username_email' ) .' /> | |
| 135 | 135 | </li><!-- .username_email --></ul>'; |
| 136 | 136 | echo apply_filters( 'wppb_recover_password_generate_password_input', $recover_input, trim( $username_email ) ); //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped |
| 137 | 137 | ?> |
| 138 | 138 | <p class="form-submit"> |
| @@ -304,10 +304,17 @@ | ||
| 304 | 304 | $username_email = ''; |
| 305 | 305 | |
| 306 | 306 | //check to see if it's an e-mail (and if this is valid/present in the database) or is a username |
| 307 | 307 | |
| 308 | - // if we do not have an email in the posted date we try to get the email for that user | |
| 309 | - if( !is_email( $username_email ) ){ | |
| 308 | + if( $username_email === '' ){ | |
| 309 | + if( !empty( $wppb_generalSettings['loginWith'] ) && $wppb_generalSettings['loginWith'] == 'email' ) | |
| 310 | + $warning = __( 'Please enter your email address.', 'profile-builder' ); | |
| 311 | + else | |
| 312 | + $warning = __( 'Please enter your username or email address.', 'profile-builder' ); | |
| 313 | + $warning = apply_filters( 'wppb_recover_password_sent_message_empty', $warning ); | |
| 314 | + $output .= wppb_password_recovery_warning( $warning, 'wppb_recover_password_displayed_message1' ); | |
| 315 | + } elseif ( !is_email( $username_email ) ){ | |
| 316 | + // if we do not have an email in the posted date we try to get the email for that user | |
| 310 | 317 | // When filter is enabled and login is set to email only, do not allow username for password reset |
| 311 | 318 | if ( apply_filters( 'wppb_recover_password_require_email_when_login_with_email', false ) && !empty( $wppb_generalSettings['loginWith'] ) && $wppb_generalSettings['loginWith'] == 'email' ) { |
| 312 | 319 | $warning = __( 'Please enter your email address to request a password reset.', 'profile-builder' ); |
| 313 | 320 | $warning = apply_filters( 'wppb_recover_password_sent_message_username_not_allowed', $warning ); |
| @@ -405,9 +412,9 @@ | ||
| 405 | 412 | // if there is no reCAPTCHA error show the invalid email address error |
| 406 | 413 | if( $warning === '' ) { |
| 407 | 414 | $warning = __('The email address entered wasn\'t found in the database!', 'profile-builder').'<br/>'.__('Please check that you entered the correct email address.', 'profile-builder'); |
| 408 | 415 | $warning = apply_filters('wppb_recover_password_sent_message2', $warning); |
| 409 | - $output .= '<p class="wppb-warning">'.$warning.'</p>'; | |
| 416 | + $output .= '<p class="wppb-warning" role="alert">'.$warning.'</p>'; | |
| 410 | 417 | } else { |
| 411 | 418 | $output .= $warning; |
| 412 | 419 | } |
| 413 | 420 | } |
| @@ -575,15 +582,15 @@ | ||
| 575 | 582 | } |
| 576 | 583 | |
| 577 | 584 | /* function for displaying success messages on the recover password page */ |
| 578 | 585 | function wppb_password_recovery_success( $message, $filter ){ |
| 579 | - return apply_filters( $filter, '<p class="wppb-success">'.$message.'</p>', $message ); | |
| 586 | + return apply_filters( $filter, '<p class="wppb-success" role="alert">'.$message.'</p>', $message ); | |
| 580 | 587 | } |
| 581 | 588 | |
| 582 | 589 | /* function for displaying warning messages on the recover password page */ |
| 583 | 590 | function wppb_password_recovery_warning( $message, $filter ){ |
| 584 | 591 | if( $message !== '' ) { |
| 585 | - return apply_filters( $filter, '<p class="wppb-warning">'.$message.'</p>', $message ); | |
| 592 | + return apply_filters( $filter, '<p class="wppb-warning" role="alert">'.$message.'</p>', $message ); | |
| 586 | 593 | } else { |
| 587 | 594 | return apply_filters( $filter, '', $message ); |
| 588 | 595 | } |
| 589 | 596 | } |
| @@ -589,9 +596,9 @@ | ||
| 589 | 596 | } |
| 590 | 597 | |
| 591 | 598 | /* function for displaying error messages on the recover password page */ |
| 592 | 599 | function wppb_password_recovery_error( $message, $filter ){ |
| 593 | - return apply_filters( $filter, '<p class="wppb-error">'.$message.'</p>', $message ); | |
| 600 | + return apply_filters( $filter, '<p class="wppb-error" role="alert">'.$message.'</p>', $message ); | |
| 594 | 601 | } |
| 595 | 602 | |
| 596 | 603 | |
| 597 | 604 | // include missing scripts needed on Elementor Pages (Form inside an Elementor Popup) |