Skip to content

Commit

Permalink
v2.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
pablo-sg-pacheco committed Jan 17, 2025
1 parent f56fd3f commit 2f30391
Show file tree
Hide file tree
Showing 10 changed files with 594 additions and 338 deletions.
25 changes: 14 additions & 11 deletions .github/workflows/deploy-to-wp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ name: Deploy to WordPress.org
on:
push:
tags:
- "*"
- "*"
jobs:
tag:
name: New tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Build
run: |
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: ${{ secrets.SVN_PLUGIN_SLUG }}
- uses: actions/checkout@master
- name: Build
run: |
- name: Install SVN ( Subversion )
run: |
sudo apt-get update
sudo apt-get install subversion
- name: WordPress Plugin Deploy
uses: 10up/action-wordpress-plugin-deploy@stable
env:
SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }}
SVN_USERNAME: ${{ secrets.SVN_USERNAME }}
SLUG: ${{ secrets.SVN_PLUGIN_SLUG }}
6 changes: 3 additions & 3 deletions email-verification-for-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
Plugin Name: Email Verification for WooCommerce
Plugin URI: https://wpfactory.com/item/email-verification-for-woocommerce/
Description: Verify user emails in WooCommerce. Beautifully.
Version: 2.9.2
Version: 2.9.3
Author: WPFactory
Author URI: https://wpfactory.com
Text Domain: emails-verification-for-woocommerce
Domain Path: /langs
Copyright: © 2024 WPFactory
WC tested up to: 9.4
WC tested up to: 9.5
Requires Plugins: woocommerce
License: GNU General Public License v3.0
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -69,7 +69,7 @@ final class Alg_WC_Email_Verification {
* @var string
* @since 1.0.0
*/
public $version = '2.9.2';
public $version = '2.9.3';

/**
* @var Alg_WC_Email_Verification The single instance of the class
Expand Down
52 changes: 41 additions & 11 deletions includes/class-alg-wc-ev-core.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - Core Class.
*
* @version 2.9.0
* @version 2.9.3
* @since 1.0.0
* @author WPFactory
*/
Expand Down Expand Up @@ -1194,7 +1194,7 @@ function get_default_hashids_salt_opt() {
/**
* enqueue_guest_feature_scripts.
*
* @version 2.9.0
* @version 2.9.3
* @since 2.9.0
*
* @return void
Expand All @@ -1209,10 +1209,27 @@ function enqueue_guest_feature_scripts() {
}

$wc_ev_options = array(
'send' => __( '<a href="javascript:;" id="alg_wc_ev_send_verify">Send Verify Email</a>', 'emails-verification-for-woocommerce' ),
'resend' => __( 'Resending....', 'emails-verification-for-woocommerce' ),
'sent' => __( 'Verification mail sent successfully to billing email, please check inbox and verify ! <a href="javascript:;" id="alg_wc_ev_resend_verify">Resend</a>', 'emails-verification-for-woocommerce' ),
'already_verified' => __( 'Email id verified !', 'emails-verification-for-woocommerce' )
'send' => sprintf(
/* translators: %s is the text for the "Send Verify Email" link text. */
'<a href="javascript:;" id="alg_wc_ev_send_verify">%s</a>',
esc_html( get_option( 'alg_wc_ev_verify_guest_send_link_text', __( 'Send Verify Email', 'emails-verification-for-woocommerce' ) ) )
),
'resend' => esc_html__( 'Resending...', 'emails-verification-for-woocommerce' ),
'sending' => esc_html__( 'Sending...', 'emails-verification-for-woocommerce' ),
'sent' => sprintf(
/* translators: %1$s is the success message, %2$s is the "Resend" link text. */
'%1$s <a href="javascript:;" id="alg_wc_ev_resend_verify">%2$s</a>',
esc_html( get_option( 'alg_wc_ev_verify_guest_verification_message', __( 'Verification mail sent successfully to billing email, please check inbox and verify!', 'emails-verification-for-woocommerce' ) ) ),
esc_html( get_option( 'alg_wc_ev_verify_guest_resent_text', __( 'Resend', 'emails-verification-for-woocommerce' ) ) )
),
'already_verified' => esc_html( get_option( 'alg_wc_ev_verify_guest_already_verification_message', __( 'Email ID verified!', 'emails-verification-for-woocommerce' ) ) ),
'error_nonce_message' => sprintf(
/* translators: %1$s is the error message, %2$s is the "Resend" link text. */
'%1$s <a href="javascript:;" id="alg_wc_ev_resend_verify">%2$s</a>',
esc_html( get_option( 'alg_wc_ev_verify_guest_verification_message', __( 'The request could not be completed due to an invalid or expired security token. Please refresh and try again!', 'emails-verification-for-woocommerce' ) ) ),
esc_html( get_option( 'alg_wc_ev_verify_guest_resent_text', __( 'Resend', 'emails-verification-for-woocommerce' ) ) )
),
'security_nonce' => wp_create_nonce( 'alg_wc_ev_ajax_security_nonce' ),
);

wp_enqueue_script( 'alg-wc-ev-guest-verify', trailingslashit( alg_wc_ev()->plugin_url() ) . 'includes/js/alg-wc-ev-guest-verify.js', array( 'jquery' ), alg_wc_ev()->version, true );
Expand All @@ -1222,7 +1239,7 @@ function enqueue_guest_feature_scripts() {
/**
* verify_guest_at_checkout_script_footer.
*
* @version 2.9.0
* @version 2.9.3
* @since 2.5.8
*
* @return string
Expand Down Expand Up @@ -1263,23 +1280,36 @@ function verify_guest_at_checkout_script_footer() {
?>
});
</script>
<style>
<style>
.alg-wc-ev-guest-verify-button {
color: green;
color: #008000;
}
</style>

.alg-wc-ev-guest-verify-error-color {
color: #ff0000;
}
</style>
<?php
}

/**
* alg_wc_ev_send_guest_verification_email_action.
*
* @version 2.9.0
* @version 2.9.3
* @since 2.5.8
*
* @return string
*/
function alg_wc_ev_send_guest_verification_email_action( $param ) {

// Check if the nonce is set and valid
if ( 'yes' === get_option( 'alg_wc_ev_nonce_verify_guest_email', 'yes' ) ) {
if ( ! isset( $_POST['security_nonce'] ) || ! wp_verify_nonce( $_POST['security_nonce'], 'alg_wc_ev_ajax_security_nonce' ) ) {
echo "invalid_nonce";
die;
}
}

if (
is_user_logged_in() ||
'yes' !== get_option( 'alg_wc_ev_verify_guest_email', 'no' )
Expand Down
152 changes: 83 additions & 69 deletions includes/js/alg-wc-ev-guest-verify.js
Original file line number Diff line number Diff line change
@@ -1,78 +1,92 @@
/**
* alg-wc-ev-guest-verify.js
*
* @version 2.7.4
* @version 2.9.3
* @since 2.7.4
*/

jQuery(function ($) {
var billing_email_input_js = $('input[name="billing_email"]');

var current_billing_email = billing_email_input_js.val();
var billing_email_paragraph = $('p[id="billing_email_field"]');
billing_email_paragraph.append('<div id="alg_wc_ev_activation_guest_verify"></div>');

var guest_email_verify_text = $('div[id="alg_wc_ev_activation_guest_verify"]');


var resend_email_verify = $('a[id="alg_wc_ev_resend_verify"]');
send_alg_wc_ev_guest_verification_email("new", current_billing_email);
billing_email_input_js.on('input change paste keyup blur', function () {
// send_alg_wc_ev_guest_verification_email("new", $(this).val());
guest_email_verify_text.html('');
var regexo = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var isValido = regexo.test($(this).val());
if (isValido) {
guest_email_verify_text.html( email_verification_options.send );
}
});


function send_alg_wc_ev_guest_verification_email(send, email) {
if (send == 'resend') {
guest_email_verify_text.html( email_verification_options.resend );
} else {
guest_email_verify_text.html('');
}
var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var isValid = regex.test(email);
if (isValid) {
var alg_wc_ev_data = {
'action': 'alg_wc_ev_send_guest_verification_email_action',
'alg_wc_ev_email': email,
'send': send
};
$.ajax({
type: "POST",
url: woocommerce_params.ajax_url,
data: alg_wc_ev_data,
success: function (response) {
if ('notsent' == response) {

} else if ('sent' == response) {
guest_email_verify_text.html( email_verification_options.sent );
guest_email_verify_text.removeClass();
guest_email_verify_text.addClass('alg-wc-ev-guest-verify-button');

// $( 'body' ).trigger( 'update_checkout' );
// jQuery( "#place_order" ).trigger( "click" );
} else if ('already_verified' == response) {
guest_email_verify_text.html( email_verification_options.already_verified );
guest_email_verify_text.removeClass();
guest_email_verify_text.addClass('alg-wc-ev-guest-verify-button');
// $( 'body' ).trigger( 'update_checkout' );
// jQuery( "#place_order" ).trigger( "click" );
}
jQuery( function ( $ ) {

var billing_email_input_js = $( 'input[name="billing_email"]' );

var current_billing_email = billing_email_input_js.val();
var billing_email_paragraph = $( 'p[id="billing_email_field"]' );
billing_email_paragraph.append( '<div id="alg_wc_ev_activation_guest_verify"></div>' );

var guest_email_verify_text = $( 'div[id="alg_wc_ev_activation_guest_verify"]' );

send_alg_wc_ev_guest_verification_email( "new", current_billing_email );

billing_email_input_js.on( 'input change paste keyup blur', function () {

guest_email_verify_text.html( '' );
var regexo = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var isValido = regexo.test( $( this ).val() );
if ( isValido ) {
guest_email_verify_text.html( email_verification_options.send );
}

} );

function send_alg_wc_ev_guest_verification_email( send, email ) {

if ( send === 'resend' ) {
guest_email_verify_text.html( email_verification_options.resend );
}
else if ( send === 'new_send' ) {
send = 'new';
guest_email_verify_text.html( email_verification_options.sending );
} else {
guest_email_verify_text.html( '' );
}

var regex = /^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;
var isValid = regex.test( email );

if ( isValid ) {

var alg_wc_ev_data = {
'action': 'alg_wc_ev_send_guest_verification_email_action',
'alg_wc_ev_email': email,
'send': send,
'security_nonce': email_verification_options.security_nonce
};

$.ajax( {
type: "POST",
url: woocommerce_params.ajax_url,
data: alg_wc_ev_data,
success: function ( response ) {
if ( 'invalid_nonce' === response ) {

guest_email_verify_text.html( email_verification_options.error_nonce_message );
guest_email_verify_text.removeClass();
guest_email_verify_text.addClass( 'alg-wc-ev-guest-verify-error-color' );

} else if ( 'sent' === response ) {

guest_email_verify_text.html( email_verification_options.sent );
guest_email_verify_text.removeClass();
guest_email_verify_text.addClass( 'alg-wc-ev-guest-verify-button' );

} else if ( 'already_verified' === response ) {

guest_email_verify_text.html( email_verification_options.already_verified );
guest_email_verify_text.removeClass();
guest_email_verify_text.addClass( 'alg-wc-ev-guest-verify-button' );

}
});
}
}
} );

}
}

$( "body" ).on( "click", "#alg_wc_ev_resend_verify", function () {
send_alg_wc_ev_guest_verification_email( "resend", $( 'input[name="billing_email"]' ).val() );
} );

$("body").on("click", "#alg_wc_ev_resend_verify", function () {
send_alg_wc_ev_guest_verification_email("resend", $('input[name="billing_email"]').val());
});

$("body").on("click", "#alg_wc_ev_send_verify", function () {
send_alg_wc_ev_guest_verification_email("new", $('input[name="billing_email"]').val());
});
});
$( "body" ).on( "click", "#alg_wc_ev_send_verify", function () {
send_alg_wc_ev_guest_verification_email( "new_send", $( 'input[name="billing_email"]' ).val() );
} );
} );
25 changes: 17 additions & 8 deletions includes/settings/class-alg-wc-ev-settings-general.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Email Verification for WooCommerce - General Section Settings
*
* @version 2.8.2
* @version 2.9.3
* @since 1.0.0
* @author WPFactory
*/
Expand All @@ -28,7 +28,7 @@ function __construct() {
/**
* get_settings.
*
* @version 2.8.2
* @version 2.9.3
* @since 1.0.0
* @todo [next] Logout unverified users on every page: better description
* @todo [next] (maybe) `alg_wc_ev_delay_wc_email`: default to `yes`?
Expand Down Expand Up @@ -62,12 +62,21 @@ function get_settings() {
'default' => 'yes',
),
array(
'title' => __( 'Guest users', 'emails-verification-for-woocommerce' ),
'desc' => __( 'Verify guest users', 'emails-verification-for-woocommerce' ),
'desc_tip' => __( 'If enabled, checkout as guest user billing address will be verified.', 'emails-verification-for-woocommerce' ),
'type' => 'checkbox',
'id' => 'alg_wc_ev_verify_guest_email',
'default' => 'no',
'title' => __( 'Guest users', 'emails-verification-for-woocommerce' ),
'desc' => __( 'Verify guest users', 'emails-verification-for-woocommerce' ),
'desc_tip' => __( 'If enabled, checkout as guest user billing address will be verified.', 'emails-verification-for-woocommerce' ),
'type' => 'checkbox',
'checkboxgroup' => 'start',
'id' => 'alg_wc_ev_verify_guest_email',
'default' => 'no',
),
array(
'desc' => __( 'Enable token verification on verify guest user', 'emails-verification-for-woocommerce' ),
'desc_tip' => __( 'If enabled, email verification will use a token for verification. Note: This option might be disabled if caching is enabled for the checkout page.', 'emails-verification-for-woocommerce' ),
'type' => 'checkbox',
'checkboxgroup' => 'end',
'id' => 'alg_wc_ev_nonce_verify_guest_email',
'default' => 'yes',
),
array(
'type' => 'sectionend',
Expand Down
Loading

0 comments on commit 2f30391

Please sign in to comment.