475a0abc by Jeff Balicki

clean up

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 2c9e80d2
......@@ -45,6 +45,7 @@ if (!$user_ID) {
#search_paginate_links {
margin-top : 30px;
}
</style>
<?php get_header("brokerlanding");
global $wpdb;
......@@ -264,5 +265,13 @@ global $wpdb;
html {
margin-top : 32px !important;
}
.menu-broker_footer-container {
float: right;
}
.menu-broker_footer-container #menu-broker_footer li {
list-style-type: none;
float: left;
padding-right: 10px;
}
</style>
<?php get_footer(); ?>
\ No newline at end of file
......
......@@ -451,7 +451,7 @@ function remove_lostpassword_text($text)
return $text;
}
add_filter('gettext', 'remove_lostpassword_text');
//add_filter('gettext', 'remove_lostpassword_text');
......@@ -939,187 +939,6 @@ function remove_admin_bar()
}
}
add_action('wp_ajax_nopriv_lost_pass', 'lost_pass_callback');
add_action('wp_ajax_lost_pass', 'lost_pass_callback');
/*
* @desc Process lost password
*/
function lost_pass_callback()
{
global $wpdb, $wp_hasher;
$nonce = $_POST['nonce'];
if (!wp_verify_nonce($nonce, 'rs_user_lost_password_action')) {
die('Security checked!');
}
//We shall SQL escape all inputs to avoid sql injection.
$user_login = $_POST['user_login'];
$errors = new WP_Error();
if (empty($user_login)) {
$errors->add('empty_username', __('ERROR: Enter a username or e-mail address.'));
} else if (strpos($user_login, '@')) {
$user_data = get_user_by('email', trim($user_login));
if (empty($user_data)) {
$errors->add('invalid_email', __('ERROR: There is no user registered with that email address.'));
}
} else {
$login = trim($user_login);
$user_data = get_user_by('login', $login);
}
/**
* Fires before errors are returned from a password reset request.
*
* @since 2.1.0
* @since 4.4.0 Added the `$errors` parameter.
*
* @param WP_Error $errors A WP_Error object containing any errors generated
* by using invalid credentials.
*/
do_action('lostpassword_post', $errors);
if ($errors->get_error_code()) {
$return = '<p class="error">' . $errors->get_error_message($errors->get_error_code()) . '</p>';
echo ($return);
die();
}
if (!$user_data) {
$errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or email.'));
$return = '<p class="error">' . $errors->get_error_message($errors->get_error_code()) . '</p>';
echo ($return);
die();
}
// Redefining user_login ensures we return the right case in the email.
$user_login = $user_data->user_login;
$user_email = $user_data->user_email;
$key = get_password_reset_key($user_data);
if (is_wp_error($key)) {
return $key;
}
$message = 'Someone requested that the password be reset for the following ' . get_bloginfo('name') . ' account:<br /><br /> ';
$message .= sprintf(__('Username: %s'), $user_login) . "<br /><br />";
$message .= '<a href=' . esc_url(get_permalink(401) . "?action=rp&key=$key&login=" . rawurlencode($user_login)) . ' mc:disable-tracking>' . __('Click here to reset your password.') . '</a><br/><br/>';
$message .= __('If you did not request to change you password, you don\'t have to do anything. Your password will not be changed.') . "<br /><br />";
//$message .= '<br /><br /><br /><br />https://'.esc_url( get_permalink( 401 ) . "/?action=rp&key=$key&login=" . rawurlencode($user_login) ) . "<br /><br />";
if (is_multisite()) {
$blogname = $GLOBALS['current_site']->site_name;
} else
/*
* The blogname option is escaped with esc_html on the way into the database
* in sanitize_option we want to reverse this for the plain text arena of emails.
*/
{
$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
}
$title = sprintf(__('Password Reset'), $blogname);
/**
* Filter the subject of the password reset email.
*
* @since 2.8.0
* @since 4.4.0 Added the `$user_login` and `$user_data` parameters.
*
* @param string $title Default email title.
* @param string $user_login The username for the user.
* @param WP_User $user_data WP_User object.
*/
$title = apply_filters('retrieve_password_title', $title, $user_login, $user_data);
/**
* Filter the message body of the password reset mail.
*
* @since 2.8.0
* @since 4.1.0 Added `$user_login` and `$user_data` parameters.
*
* @param string $message Default mail message.
* @param string $key The activation key.
* @param string $user_login The username for the user.
* @param WP_User $user_data WP_User object.
*/
$message = apply_filters('retrieve_password_message', $message, $key, $user_login, $user_data);
if (wp_mail($user_email, wp_specialchars_decode($title), $message)) {
$errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message');
} else {
$errors->add('could_not_sent', __('The e-mail could not be sent.') . "<br />\n" . __('Possible reason: your host may have disabled the mail() function.'), 'message');
}
// display error message
if ($errors) {
$return = '<p class="error">' . $errors->get_error_message($errors->get_error_code()) . '</p>';
echo ($return);
die();
}
// return proper result
die();
}
add_action('wp_ajax_nopriv_reset_pass', 'reset_pass_callback');
add_action('wp_ajax_reset_pass', 'reset_pass_callback');
/*
* @desc Process reset password
*/
function reset_pass_callback()
{
$errors = new WP_Error();
$nonce = $_POST['nonce'];
$pass1 = $_POST['pass1'];
$pass2 = $_POST['pass2'];
$key = $_POST['user_key'];
$login = $_POST['user_login'];
$user = check_password_reset_key($key, $login);
// check to see if user added some string
if (empty($pass1) || empty($pass2)) {
$errors->add('password_required', __('Password is required field'));
}
// is pass1 and pass2 match?
if (isset($pass1) && $pass1 != $pass2) {
$errors->add('password_reset_mismatch', __('The passwords do not match.'));
}
/**
* Fires before the password reset procedure is validated.
*
* @since 3.5.0
*
* @param object $errors WP Error object.
* @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise.
*/
do_action('validate_password_reset', $errors, $user);
if ((!$errors->get_error_code()) && isset($pass1) && !empty($pass1)) {
reset_password($user, $pass1);
$errors->add('password_reset', __('Your password has been reset.'));
}
// display error message
if ($errors->get_error_code()) {
echo '<p class="error">' . $errors->get_error_message($errors->get_error_code()) . '</p>';
}
// return proper result
die();
}
// localize wp-ajax, notice the path to our theme-ajax.js file
wp_enqueue_script('rsclean-request-script', get_stylesheet_directory_uri() . '/scripts/src/theme-ajax.js', array('jquery'));
......