clean up
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
2 changed files
with
10 additions
and
182 deletions
| ... | @@ -45,6 +45,7 @@ if (!$user_ID) { | ... | @@ -45,6 +45,7 @@ if (!$user_ID) { |
| 45 | #search_paginate_links { | 45 | #search_paginate_links { |
| 46 | margin-top : 30px; | 46 | margin-top : 30px; |
| 47 | } | 47 | } |
| 48 | |||
| 48 | </style> | 49 | </style> |
| 49 | <?php get_header("brokerlanding"); | 50 | <?php get_header("brokerlanding"); |
| 50 | global $wpdb; | 51 | global $wpdb; |
| ... | @@ -264,5 +265,13 @@ global $wpdb; | ... | @@ -264,5 +265,13 @@ global $wpdb; |
| 264 | html { | 265 | html { |
| 265 | margin-top : 32px !important; | 266 | margin-top : 32px !important; |
| 266 | } | 267 | } |
| 268 | .menu-broker_footer-container { | ||
| 269 | float: right; | ||
| 270 | } | ||
| 271 | .menu-broker_footer-container #menu-broker_footer li { | ||
| 272 | list-style-type: none; | ||
| 273 | float: left; | ||
| 274 | padding-right: 10px; | ||
| 275 | } | ||
| 267 | </style> | 276 | </style> |
| 268 | <?php get_footer(); ?> | 277 | <?php get_footer(); ?> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -451,7 +451,7 @@ function remove_lostpassword_text($text) | ... | @@ -451,7 +451,7 @@ function remove_lostpassword_text($text) |
| 451 | return $text; | 451 | return $text; |
| 452 | } | 452 | } |
| 453 | 453 | ||
| 454 | add_filter('gettext', 'remove_lostpassword_text'); | 454 | //add_filter('gettext', 'remove_lostpassword_text'); |
| 455 | 455 | ||
| 456 | 456 | ||
| 457 | 457 | ||
| ... | @@ -939,187 +939,6 @@ function remove_admin_bar() | ... | @@ -939,187 +939,6 @@ function remove_admin_bar() |
| 939 | } | 939 | } |
| 940 | } | 940 | } |
| 941 | 941 | ||
| 942 | add_action('wp_ajax_nopriv_lost_pass', 'lost_pass_callback'); | ||
| 943 | add_action('wp_ajax_lost_pass', 'lost_pass_callback'); | ||
| 944 | /* | ||
| 945 | * @desc Process lost password | ||
| 946 | */ | ||
| 947 | function lost_pass_callback() | ||
| 948 | { | ||
| 949 | |||
| 950 | global $wpdb, $wp_hasher; | ||
| 951 | |||
| 952 | $nonce = $_POST['nonce']; | ||
| 953 | |||
| 954 | if (!wp_verify_nonce($nonce, 'rs_user_lost_password_action')) { | ||
| 955 | die('Security checked!'); | ||
| 956 | } | ||
| 957 | |||
| 958 | //We shall SQL escape all inputs to avoid sql injection. | ||
| 959 | $user_login = $_POST['user_login']; | ||
| 960 | |||
| 961 | $errors = new WP_Error(); | ||
| 962 | |||
| 963 | if (empty($user_login)) { | ||
| 964 | $errors->add('empty_username', __('ERROR: Enter a username or e-mail address.')); | ||
| 965 | } else if (strpos($user_login, '@')) { | ||
| 966 | $user_data = get_user_by('email', trim($user_login)); | ||
| 967 | if (empty($user_data)) { | ||
| 968 | $errors->add('invalid_email', __('ERROR: There is no user registered with that email address.')); | ||
| 969 | } | ||
| 970 | |||
| 971 | } else { | ||
| 972 | $login = trim($user_login); | ||
| 973 | $user_data = get_user_by('login', $login); | ||
| 974 | } | ||
| 975 | |||
| 976 | /** | ||
| 977 | * Fires before errors are returned from a password reset request. | ||
| 978 | * | ||
| 979 | * @since 2.1.0 | ||
| 980 | * @since 4.4.0 Added the `$errors` parameter. | ||
| 981 | * | ||
| 982 | * @param WP_Error $errors A WP_Error object containing any errors generated | ||
| 983 | * by using invalid credentials. | ||
| 984 | */ | ||
| 985 | do_action('lostpassword_post', $errors); | ||
| 986 | |||
| 987 | if ($errors->get_error_code()) { | ||
| 988 | $return = '<p class="error">' . $errors->get_error_message($errors->get_error_code()) . '</p>'; | ||
| 989 | echo ($return); | ||
| 990 | die(); | ||
| 991 | } | ||
| 992 | if (!$user_data) { | ||
| 993 | $errors->add('invalidcombo', __('<strong>ERROR</strong>: Invalid username or email.')); | ||
| 994 | $return = '<p class="error">' . $errors->get_error_message($errors->get_error_code()) . '</p>'; | ||
| 995 | echo ($return); | ||
| 996 | die(); | ||
| 997 | } | ||
| 998 | |||
| 999 | // Redefining user_login ensures we return the right case in the email. | ||
| 1000 | $user_login = $user_data->user_login; | ||
| 1001 | $user_email = $user_data->user_email; | ||
| 1002 | $key = get_password_reset_key($user_data); | ||
| 1003 | |||
| 1004 | if (is_wp_error($key)) { | ||
| 1005 | return $key; | ||
| 1006 | } | ||
| 1007 | |||
| 1008 | $message = 'Someone requested that the password be reset for the following ' . get_bloginfo('name') . ' account:<br /><br /> '; | ||
| 1009 | $message .= sprintf(__('Username: %s'), $user_login) . "<br /><br />"; | ||
| 1010 | |||
| 1011 | $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/>'; | ||
| 1012 | $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 />"; | ||
| 1013 | //$message .= '<br /><br /><br /><br />https://'.esc_url( get_permalink( 401 ) . "/?action=rp&key=$key&login=" . rawurlencode($user_login) ) . "<br /><br />"; | ||
| 1014 | |||
| 1015 | if (is_multisite()) { | ||
| 1016 | $blogname = $GLOBALS['current_site']->site_name; | ||
| 1017 | } else | ||
| 1018 | /* | ||
| 1019 | * The blogname option is escaped with esc_html on the way into the database | ||
| 1020 | * in sanitize_option we want to reverse this for the plain text arena of emails. | ||
| 1021 | */ | ||
| 1022 | { | ||
| 1023 | $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); | ||
| 1024 | } | ||
| 1025 | |||
| 1026 | $title = sprintf(__('Password Reset'), $blogname); | ||
| 1027 | |||
| 1028 | /** | ||
| 1029 | * Filter the subject of the password reset email. | ||
| 1030 | * | ||
| 1031 | * @since 2.8.0 | ||
| 1032 | * @since 4.4.0 Added the `$user_login` and `$user_data` parameters. | ||
| 1033 | * | ||
| 1034 | * @param string $title Default email title. | ||
| 1035 | * @param string $user_login The username for the user. | ||
| 1036 | * @param WP_User $user_data WP_User object. | ||
| 1037 | */ | ||
| 1038 | $title = apply_filters('retrieve_password_title', $title, $user_login, $user_data); | ||
| 1039 | |||
| 1040 | /** | ||
| 1041 | * Filter the message body of the password reset mail. | ||
| 1042 | * | ||
| 1043 | * @since 2.8.0 | ||
| 1044 | * @since 4.1.0 Added `$user_login` and `$user_data` parameters. | ||
| 1045 | * | ||
| 1046 | * @param string $message Default mail message. | ||
| 1047 | * @param string $key The activation key. | ||
| 1048 | * @param string $user_login The username for the user. | ||
| 1049 | * @param WP_User $user_data WP_User object. | ||
| 1050 | */ | ||
| 1051 | $message = apply_filters('retrieve_password_message', $message, $key, $user_login, $user_data); | ||
| 1052 | |||
| 1053 | if (wp_mail($user_email, wp_specialchars_decode($title), $message)) { | ||
| 1054 | $errors->add('confirm', __('Check your e-mail for the confirmation link.'), 'message'); | ||
| 1055 | } else { | ||
| 1056 | $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'); | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | // display error message | ||
| 1060 | if ($errors) { | ||
| 1061 | |||
| 1062 | $return = '<p class="error">' . $errors->get_error_message($errors->get_error_code()) . '</p>'; | ||
| 1063 | echo ($return); | ||
| 1064 | die(); | ||
| 1065 | } | ||
| 1066 | // return proper result | ||
| 1067 | |||
| 1068 | die(); | ||
| 1069 | } | ||
| 1070 | |||
| 1071 | add_action('wp_ajax_nopriv_reset_pass', 'reset_pass_callback'); | ||
| 1072 | add_action('wp_ajax_reset_pass', 'reset_pass_callback'); | ||
| 1073 | /* | ||
| 1074 | * @desc Process reset password | ||
| 1075 | */ | ||
| 1076 | function reset_pass_callback() | ||
| 1077 | { | ||
| 1078 | |||
| 1079 | $errors = new WP_Error(); | ||
| 1080 | $nonce = $_POST['nonce']; | ||
| 1081 | |||
| 1082 | $pass1 = $_POST['pass1']; | ||
| 1083 | $pass2 = $_POST['pass2']; | ||
| 1084 | $key = $_POST['user_key']; | ||
| 1085 | $login = $_POST['user_login']; | ||
| 1086 | |||
| 1087 | $user = check_password_reset_key($key, $login); | ||
| 1088 | |||
| 1089 | // check to see if user added some string | ||
| 1090 | if (empty($pass1) || empty($pass2)) { | ||
| 1091 | $errors->add('password_required', __('Password is required field')); | ||
| 1092 | } | ||
| 1093 | |||
| 1094 | // is pass1 and pass2 match? | ||
| 1095 | if (isset($pass1) && $pass1 != $pass2) { | ||
| 1096 | $errors->add('password_reset_mismatch', __('The passwords do not match.')); | ||
| 1097 | } | ||
| 1098 | |||
| 1099 | /** | ||
| 1100 | * Fires before the password reset procedure is validated. | ||
| 1101 | * | ||
| 1102 | * @since 3.5.0 | ||
| 1103 | * | ||
| 1104 | * @param object $errors WP Error object. | ||
| 1105 | * @param WP_User|WP_Error $user WP_User object if the login and reset key match. WP_Error object otherwise. | ||
| 1106 | */ | ||
| 1107 | do_action('validate_password_reset', $errors, $user); | ||
| 1108 | |||
| 1109 | if ((!$errors->get_error_code()) && isset($pass1) && !empty($pass1)) { | ||
| 1110 | reset_password($user, $pass1); | ||
| 1111 | |||
| 1112 | $errors->add('password_reset', __('Your password has been reset.')); | ||
| 1113 | } | ||
| 1114 | |||
| 1115 | // display error message | ||
| 1116 | if ($errors->get_error_code()) { | ||
| 1117 | echo '<p class="error">' . $errors->get_error_message($errors->get_error_code()) . '</p>'; | ||
| 1118 | } | ||
| 1119 | |||
| 1120 | // return proper result | ||
| 1121 | die(); | ||
| 1122 | } | ||
| 1123 | 942 | ||
| 1124 | // localize wp-ajax, notice the path to our theme-ajax.js file | 943 | // localize wp-ajax, notice the path to our theme-ajax.js file |
| 1125 | wp_enqueue_script('rsclean-request-script', get_stylesheet_directory_uri() . '/scripts/src/theme-ajax.js', array('jquery')); | 944 | wp_enqueue_script('rsclean-request-script', get_stylesheet_directory_uri() . '/scripts/src/theme-ajax.js', array('jquery')); | ... | ... |
-
Please register or sign in to post a comment