Fixed password reset handler
This commit is contained in:
parent
e87aefc8e0
commit
744f80e0c6
|
@ -828,7 +828,6 @@ class WC_Form_Handler {
|
||||||
|
|
||||||
// process lost password form
|
// process lost password form
|
||||||
if ( isset( $_POST['user_login'] ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'lost_password' ) ) {
|
if ( isset( $_POST['user_login'] ) && isset( $_POST['_wpnonce'] ) && wp_verify_nonce( $_POST['_wpnonce'], 'lost_password' ) ) {
|
||||||
|
|
||||||
WC_Shortcode_My_Account::retrieve_password();
|
WC_Shortcode_My_Account::retrieve_password();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,19 +838,12 @@ class WC_Form_Handler {
|
||||||
$user = WC_Shortcode_My_Account::check_password_reset_key( $_POST['reset_key'], $_POST['reset_login'] );
|
$user = WC_Shortcode_My_Account::check_password_reset_key( $_POST['reset_key'], $_POST['reset_login'] );
|
||||||
|
|
||||||
if ( is_object( $user ) ) {
|
if ( is_object( $user ) ) {
|
||||||
|
|
||||||
// save these values into the form again in case of errors
|
|
||||||
$args['key'] = wc_clean( $_POST['reset_key'] );
|
|
||||||
$args['login'] = wc_clean( $_POST['reset_login'] );
|
|
||||||
|
|
||||||
if ( empty( $_POST['password_1'] ) || empty( $_POST['password_2'] ) ) {
|
if ( empty( $_POST['password_1'] ) || empty( $_POST['password_2'] ) ) {
|
||||||
wc_add_notice( __( 'Please enter your password.', 'woocommerce' ), 'error' );
|
wc_add_notice( __( 'Please enter your password.', 'woocommerce' ), 'error' );
|
||||||
$args['form'] = 'reset_password';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $_POST[ 'password_1' ] !== $_POST[ 'password_2' ] ) {
|
if ( $_POST[ 'password_1' ] !== $_POST[ 'password_2' ] ) {
|
||||||
wc_add_notice( __( 'Passwords do not match.', 'woocommerce' ), 'error' );
|
wc_add_notice( __( 'Passwords do not match.', 'woocommerce' ), 'error' );
|
||||||
$args['form'] = 'reset_password';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$errors = new WP_Error();
|
$errors = new WP_Error();
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
/**
|
/**
|
||||||
* Lost password form
|
* Lost password form
|
||||||
*
|
*
|
||||||
* @author WooThemes
|
* @author WooThemes
|
||||||
* @package WooCommerce/Templates
|
* @package WooCommerce/Templates
|
||||||
* @version 2.0.0
|
* @version 2.3.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( ! defined( 'ABSPATH' ) ) {
|
if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
@ -43,7 +43,11 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
|
|
||||||
<div class="clear"></div>
|
<div class="clear"></div>
|
||||||
|
|
||||||
<p class="form-row"><input type="submit" class="button" name="wc_reset_password" value="<?php echo 'lost_password' == $args['form'] ? __( 'Reset Password', 'woocommerce' ) : __( 'Save', 'woocommerce' ); ?>" /></p>
|
<p class="form-row">
|
||||||
|
<input type="hidden" name="wc_reset_password" value="true" />
|
||||||
|
<input type="submit" class="button" value="<?php echo 'lost_password' == $args['form'] ? __( 'Reset Password', 'woocommerce' ) : __( 'Save', 'woocommerce' ); ?>" />
|
||||||
|
</p>
|
||||||
|
|
||||||
<?php wp_nonce_field( $args['form'] ); ?>
|
<?php wp_nonce_field( $args['form'] ); ?>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue