| 1 |
<?php |
| 2 |
$errors = new \WP_Error(); |
| 3 |
|
| 4 |
if ( isset( $_POST['pass1'], $_POST['pass2'] ) && $_POST['pass1'] !== $_POST['pass2'] ) { |
| 5 |
$errors->add( 'password_reset_mismatch', __( 'The passwords do not match.', 'wpdef' ) ); |
| 6 |
} |
| 7 |
if ( ( ! $errors->has_errors() ) && isset( $_POST['pass1'] ) && ! empty( $_POST['pass1'] ) ) { |
| 8 |
reset_password( $user, $_POST['pass1'] ); |
| 9 |
login_header( __( 'Password Reset', 'wpdef' ), '<p class="message reset-pass">' . __( 'Your password has been reset.', 'wpdef' ) . ' <a href="' . esc_url( wp_login_url() ) . '">' . __( 'Log in', 'wpdef' ) . '</a></p>' ); |
| 10 |
login_footer(); |
| 11 |
exit; |
| 12 |
} |
| 13 |
|
| 14 |
do_action( 'validate_password_reset', $errors, $user ); |
| 15 |
$login_link_separator = apply_filters( 'login_link_separator', ' | ' ); |
| 16 |
|
| 17 |
wp_enqueue_script( 'utils' ); |
| 18 |
wp_enqueue_script( 'user-profile' ); |
| 19 |
|
| 20 |
do_action( 'wd_password_change_form', $user ); |
| 21 |
login_header( __( 'Reset Password', 'wpdef' ), '<p class="message reset-pass">' . __( 'Enter your new password below or generate one.', 'wpdef' ) . '</p>', $errors ); |
| 22 |
?> |
| 23 |
<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( network_site_url( 'wp-login.php?action=resetpass', 'login_post' ) ); ?>" method="post" autocomplete="off"> |
| 24 |
<input type="hidden" id="user_login" value="<?php echo esc_attr( $user->user_login ); ?>" autocomplete="off" /> |
| 25 |
<div class="user-pass1-wrap"> |
| 26 |
<p><label for="pass1"><?php _e( 'New Password', 'wpdef' ); ?></label></p> |
| 27 |
</div> |
| 28 |
|
| 29 |
<div class="wp-pwd"> |
| 30 |
<input type="password" data-reveal="1" data-pw="<?php echo esc_attr( wp_generate_password( 16 ) ); ?>" name="pass1" id="pass1" class="input password-input" size="24" value="" autocomplete="off" aria-describedby="pass-strength-result" /> |
| 31 |
|
| 32 |
<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
| 33 |
<span class="dashicons dashicons-hidden" aria-hidden="true"></span> |
| 34 |
</button> |
| 35 |
<div id="pass-strength-result" class="hide-if-no-js" aria-live="polite"><?php _e( 'Strength indicator', 'wpdef' ); ?></div> |
| 36 |
</div> |
| 37 |
<div class="pw-weak"> |
| 38 |
<input type="checkbox" name="pw_weak" id="pw-weak" class="pw-checkbox" /> |
| 39 |
<label for="pw-weak"><?php _e( 'Confirm use of weak password', 'wpdef' ); ?></label> |
| 40 |
</div> |
| 41 |
|
| 42 |
<p class="user-pass2-wrap"> |
| 43 |
<label for="pass2"><?php _e( 'Confirm new password', 'wpdef' ); ?></label><br/> |
| 44 |
<input type="password" name="pass2" id="pass2" class="input" size="20" value="" autocomplete="off"/> |
| 45 |
</p> |
| 46 |
|
| 47 |
<p class="description indicator-hint"><?php echo wp_get_password_hint(); ?></p> |
| 48 |
<br class="clear"/> |
| 49 |
<?php |
| 50 |
do_action( 'resetpass_form', $user ); |
| 51 |
?> |
| 52 |
|
| 53 |
<p class="submit reset-pass-submit"> |
| 54 |
<button type="button" class="button wp-generate-pw hide-if-no-js" aria-expanded="true"><?php _e( 'Generate Password', 'wpdef' ); ?></button> |
| 55 |
<input type="submit" name="wp-submit" id="wp-submit" class="button button-primary button-large" value="<?php esc_attr_e( 'Save Password', 'wpdef' ); ?>" /> |
| 56 |
</p> |
| 57 |
</form> |
| 58 |
<p id="nav"> |
| 59 |
<a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log in', 'wpdef' ); ?></a> |
| 60 |
<?php |
| 61 |
|
| 62 |
if ( get_option( 'users_can_register' ) ) { |
| 63 |
$registration_url = sprintf( '<a href="%s">%s</a>', esc_url( wp_registration_url() ), __( 'Register', 'wpdef' ) ); |
| 64 |
|
| 65 |
echo esc_html( $login_link_separator ); |
| 66 |
|
| 67 |
/** This filter is documented in wp-includes/general-template.php */ |
| 68 |
echo apply_filters( 'register', $registration_url ); |
| 69 |
} |
| 70 |
|
| 71 |
?> |
| 72 |
</p> |
| 73 |
<?php |
| 74 |
|
| 75 |
login_footer( 'user_pass' ); |
| 76 |
|