Fix disable password submitting twice

This commit is contained in:
Nicola Mustone 2014-10-16 21:59:45 +02:00
parent cf2e17e74c
commit 6e9176a5bf
5 changed files with 42 additions and 18 deletions

View File

@ -0,0 +1,5 @@
jQuery( function( $ ) {
$( '.lost_reset_password' ).on( 'submit', function () {
$( 'input[type="submit"]', this ).attr( 'disabled', 'disabled' );
});
});

View File

@ -0,0 +1 @@
jQuery(function(a){a(".lost_reset_password").on("submit",function(){a('input[type="submit"]',this).attr("disabled","disabled")})});

View File

@ -140,6 +140,9 @@ class WC_Frontend_Scripts {
if ( is_add_payment_method_page() ) {
self::enqueue_script( 'wc-add-payment-method', $frontend_script_path . 'add-payment-method' . $suffix . '.js', array( 'jquery', 'woocommerce' ) );
}
if ( is_lost_password_page() ) {
self::enqueue_script( 'wc-lost-password', $frontend_script_path . 'lost-password' . $suffix . '.js', array( 'jquery', 'woocommerce' ) );
}
if ( $lightbox_en && ( is_product() || ( ! empty( $post->post_content ) && strstr( $post->post_content, '[product_page' ) ) ) ) {
self::enqueue_script( 'prettyPhoto', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto' . $suffix . '.js', array( 'jquery' ), '3.1.5', true );
self::enqueue_script( 'prettyPhoto-init', $assets_path . 'js/prettyPhoto/jquery.prettyPhoto.init' . $suffix . '.js', array( 'jquery','prettyPhoto' ) );

View File

@ -199,6 +199,21 @@ if ( ! function_exists( 'is_add_payment_method_page' ) ) {
}
}
if ( ! function_exists( 'is_lost_password_page' ) ) {
/**
* is_lost_password_page - Returns true when viewing the lost password page.
*
* @access public
* @return bool
*/
function is_lost_password_page() {
global $wp;
return ( is_page( wc_get_page_id( 'myaccount' ) ) && isset( $wp->query_vars['lost-password'] ) ) ? true : false;
}
}
if ( ! function_exists( 'is_ajax' ) ) {
/**

View File

@ -2,8 +2,8 @@
/**
* Lost password form
*
* @author WooThemes
* @package WooCommerce/Templates
* @author WooThemes
* @package WooCommerce/Templates
* @version 2.0.0
*/
@ -19,31 +19,31 @@ if ( ! defined( 'ABSPATH' ) ) {
<?php if( 'lost_password' == $args['form'] ) : ?>
<p><?php echo apply_filters( 'woocommerce_lost_password_message', __( 'Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.', 'woocommerce' ) ); ?></p>
<p><?php echo apply_filters( 'woocommerce_lost_password_message', __( 'Lost your password? Please enter your username or email address. You will receive a link to create a new password via email.', 'woocommerce' ) ); ?></p>
<p class="form-row form-row-first"><label for="user_login"><?php _e( 'Username or email', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="user_login" id="user_login" /></p>
<p class="form-row form-row-first"><label for="user_login"><?php _e( 'Username or email', 'woocommerce' ); ?></label> <input class="input-text" type="text" name="user_login" id="user_login" /></p>
<?php else : ?>
<p><?php echo apply_filters( 'woocommerce_reset_password_message', __( 'Enter a new password below.', 'woocommerce') ); ?></p>
<p><?php echo apply_filters( 'woocommerce_reset_password_message', __( 'Enter a new password below.', 'woocommerce') ); ?></p>
<p class="form-row form-row-first">
<label for="password_1"><?php _e( 'New password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="input-text" name="password_1" id="password_1" />
</p>
<p class="form-row form-row-last">
<label for="password_2"><?php _e( 'Re-enter new password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="input-text" name="password_2" id="password_2" />
</p>
<p class="form-row form-row-first">
<label for="password_1"><?php _e( 'New password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="input-text" name="password_1" id="password_1" />
</p>
<p class="form-row form-row-last">
<label for="password_2"><?php _e( 'Re-enter new password', 'woocommerce' ); ?> <span class="required">*</span></label>
<input type="password" class="input-text" name="password_2" id="password_2" />
</p>
<input type="hidden" name="reset_key" value="<?php echo isset( $args['key'] ) ? $args['key'] : ''; ?>" />
<input type="hidden" name="reset_login" value="<?php echo isset( $args['login'] ) ? $args['login'] : ''; ?>" />
<input type="hidden" name="reset_key" value="<?php echo isset( $args['key'] ) ? $args['key'] : ''; ?>" />
<input type="hidden" name="reset_login" value="<?php echo isset( $args['login'] ) ? $args['login'] : ''; ?>" />
<?php endif; ?>
<?php endif; ?>
<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="submit" class="button" name="wc_reset_password" value="<?php echo 'lost_password' == $args['form'] ? __( 'Reset Password', 'woocommerce' ) : __( 'Save', 'woocommerce' ); ?>" /></p>
<?php wp_nonce_field( $args['form'] ); ?>
</form>