Our website is using Wordpress - WooCommerce login page for customers to login.
I am trying to use wp_authenticate() to achieve the following:
1) Customer login to our new website, enter their username and password, and hit Login button. In case you want to see WooCommerce Login file, click here.
2) Our new website goes through list see if the username matches. If the username matches, don't even look at the password, just redirect the user to other url such as google.com
3) if the username doesn't match with our list, just let them login as usual.
With JQuery, someone helped me to come up with the following code:
var names = new Array(”BILL”, ”JIM”, ”BOB”); // get all names into array, and all in uppercase
var dest_url = ”http://www.website.com”; // URL we want to send them to
jQuery(document).ready(function () {
jQuery(”input[name=’login’]”).click(function(event){
event.preventDefault(); // prevent default form action
var current_name = jQuery(”#username”).val();
current_name = current_name.trim().toUpperCase();
if ( -1 != jQuery.inArray(current_name, names) ) {
alert(”Redirecting ” + current_name + ” to ” + dest_url);
window.location = dest_url; // send to desired URL
}
else
document.getElementsByClassName(”login”)[0].submit(); // input name not on our list, so just do normal submit action
});
});
But I am not sure if wp_authenticate() can actually contain jquery script inside. Any suggestion would be greatly appreciated.