Changeset 2974859
- Timestamp:
- 10/04/2023 04:46:41 PM (10 months ago)
- Location:
- directorist
- Files:
-
- 12 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
directorist/tags/7.7.3/config.php
r2965600 r2974859 1 1 <?php 2 2 // Plugin version. 3 if ( ! defined( 'ATBDP_VERSION' ) ) {define( 'ATBDP_VERSION', '7.7. 2' );}3 if ( ! defined( 'ATBDP_VERSION' ) ) {define( 'ATBDP_VERSION', '7.7.' );} 4 4 // Plugin Folder Path. 5 5 if ( ! defined( 'ATBDP_DIR' ) ) { define( 'ATBDP_DIR', plugin_dir_path( __FILE__ ) ); } -
directorist/tags/7.7.3/directorist-base.php
r2965600 r2974859 4 4 * Plugin URI: https://wpwax.com 5 5 * Description: A comprehensive solution to create professional looking directory site of any kind. Like Yelp, Foursquare, etc. 6 * Version: 7.7. 26 * Version: 7.7. 7 7 * Author: wpWax 8 8 * Author URI: https://wpwax.com -
directorist/tags/7.7.3/includes/classes/class-email.php
r2957174 r2974859 78 78 } 79 79 if ( empty( $user ) ) { 80 $post_author_id = get_post_field( 'post_author', $listing_id );80 $post_author_id = get_post_field( 'post_author', $listing_id ); 81 81 $user = get_userdata( $post_author_id ); 82 82 } else { … … 954 954 955 955 if ( 'bank_transfer' !== $gateway ) { 956 return false; 956 return false; 957 957 } 958 958 … … 1087 1087 * @return bool Whether the email was sent successfully or not. 1088 1088 */ 1089 public function send_password_reset_pin_email( $listing_email ) { 1090 $s = __( '[==SITE_NAME==] Password Reset PIN', 'directorist' ); 1091 $sub = str_replace( '==SITE_NAME==', get_option( 'blogname' ), $s ); 1092 $pin = random_int( 1000, 9999 ); 1093 1094 $min = 15; 1095 $expiration = 60 * $min; // In seconds 1096 1097 set_transient( "directorist_reset_pin_${listing_email}", $pin, $expiration ); 1098 1099 $body = $this->get_password_reset_pin_email_template(); 1100 $message = $this->replace_in_content( $body, $order_id = 0, $listing_id = 0, $user = null, $renewal = null, $pin ); 1101 $body = atbdp_email_html( $sub, $message ); 1102 1103 return $this->send_mail( $listing_email, $sub, $body, $this->get_email_headers() ); 1104 1089 public function send_password_reset_pin_email( $user ) { 1090 $subject = esc_html( sprintf( __( '[%s] Password Reset PIN', 'directorist' ), get_option( 'blogname' ) ) ); 1091 $user_email = $user->user_email; 1092 $pin_code = directorist_generate_password_reset_pin_code( $user ); 1093 $body = $this->get_password_reset_pin_email_template(); 1094 $message = $this->replace_in_content( $body, 0, 0, $user, null, $pin_code ); 1095 $body = atbdp_email_html( $subject, $message ); 1096 1097 return $this->send_mail( $user_email, $subject, $body, $this->get_email_headers() ); 1105 1098 } 1106 1099 -
directorist/tags/7.7.3/includes/helper-functions.php
r2957174 r2974859 4120 4120 return ( float ) $item; 4121 4121 } 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 -
directorist/tags/7.7.3/includes/rest-api/Version1/class-users-account-controller.php
r2628042 r2974859 31 31 public function register_routes() { 32 32 // Send Password Reset PIN 33 33 register_rest_route( $this->namespace, '/' . $this->rest_base . '/send-password-reset-pin', array( 34 34 'methods' => WP_REST_Server::CREATABLE, 35 35 'callback' => array( $this, 'send_password_reset_pin' ), … … 46 46 47 47 // Verify Password Reset PIN 48 48 register_rest_route( $this->namespace, '/' . $this->rest_base . '/verify-password-reset-pin', array( 49 49 'methods' => WP_REST_Server::CREATABLE, 50 50 'callback' => array( $this, 'verify_password_reset_pin' ), … … 66 66 67 67 // Rest user password. 68 68 register_rest_route( $this->namespace, '/' . $this->rest_base . '/reset-user-password', array( 69 69 'methods' => WP_REST_Server::CREATABLE, 70 70 'callback' => array( $this, 'reset_user_password' ), … … 92 92 93 93 // Change password. 94 94 register_rest_route( $this->namespace, '/' . $this->rest_base . '/change-password', array( 95 95 'methods' => WP_REST_Server::CREATABLE, 96 96 'callback' => array( $this, 'change_password' ), … … 168 168 169 169 public function send_password_reset_pin( $request ) { 170 ATBDP()->email->send_password_reset_pin_email( $request['email'] ); 171 172 $data = [ 173 'success' => true, 174 'message' => __( 'Password reset code has been sent to given email.', 'directorist' ), 170 $user = $this->get_user_by_email( $request['email'] ); 171 172 ATBDP()->email->send_password_reset_pin_email( $user ); 173 174 $data = [ 175 'success' => true, 176 'message' => __( 'Password reset code has been sent to your email.', 'directorist' ), 175 177 'email' => $request['email'], 176 178 ]; … … 182 184 183 185 public function verify_password_reset_pin( $request ) { 184 $email = $request['email']; 185 $password_pin = get_transient( "directorist_reset_pin_$email" ); 186 187 if ( empty( $password_pin ) ) { 188 return new WP_Error( 'directorist_rest_password_rest_pin_expired', __( 'Given password reset pin has expired.', 'directorist' ), array( 'status' => 400 ) ); 189 } 190 191 if ( $password_pin != $request['pin'] ) { 192 return new WP_Error( 'directorist_rest_password_rest_pin_invalid', __( 'Invalid password rest pin.', 'directorist' ), array( 'status' => 400 ) ); 193 } 186 $is_valid = $this->validate_reset_pin_code( $request ); 187 188 if ( is_wp_error( $is_valid ) ) { 189 return $is_valid; 190 } 194 191 195 192 $data = [ … … 204 201 205 202 public function reset_user_password( $request ) { 206 $email = $request['email']; 207 $user = get_user_by( 'email', $email ); 208 $password_pin = get_transient( "directorist_reset_pin_$email" ); 209 210 if ( empty( $password_pin ) ) { 211 return new WP_Error( 'directorist_rest_password_rest_pin_expired', __( 'Your password reset pin has expired.', 'directorist' ), array( 'status' => 400 ) ); 212 } 213 214 if ( $password_pin != $request['pin'] ) { 215 return new WP_Error( 'directorist_rest_password_rest_pin_invalid', __( 'Invalid password rest pin.', 'directorist' ), array( 'status' => 400 ) ); 216 } 217 218 // Change Password 219 wp_set_password( $request['password'], $user->ID ); 220 221 // Delete The PIN 222 delete_transient( "directorist_reset_pin_$email" ); 203 $is_valid = $this->validate_reset_pin_code( $request ); 204 205 if ( is_wp_error( $is_valid ) ) { 206 return $is_valid; 207 } 208 209 $user = $this->get_user_by_email( $request['email'] ); 210 211 wp_set_password( $request['password'], $user->ID ); 212 213 directorist_delete_password_reset_code_transient( $user ); 214 delete_user_meta( $user->ID, 'directorist_pasword_reset_key' ); 223 215 224 216 $data = [ … … 241 233 242 234 // Change Password 243 235 wp_set_password( $request['new_password'], $user->ID ); 244 236 245 237 $data = [ … … 252 244 return $response; 253 245 } 246 247 248 249 250 251 252 253 254 255 256 257 258 259 254 260 } -
directorist/tags/7.7.3/readme.txt
r2965600 r2974859 6 6 Tested up to: 6.3 7 7 Requires PHP: 7.0 8 Stable tag: 7.7. 28 Stable tag: 7.7. 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 410 410 411 411 == Changelog == 412 413 414 415 412 416 413 417 7.7.2 - Sep 12, 2023 -
directorist/trunk/config.php
r2965600 r2974859 1 1 <?php 2 2 // Plugin version. 3 if ( ! defined( 'ATBDP_VERSION' ) ) {define( 'ATBDP_VERSION', '7.7. 2' );}3 if ( ! defined( 'ATBDP_VERSION' ) ) {define( 'ATBDP_VERSION', '7.7.' );} 4 4 // Plugin Folder Path. 5 5 if ( ! defined( 'ATBDP_DIR' ) ) { define( 'ATBDP_DIR', plugin_dir_path( __FILE__ ) ); } -
directorist/trunk/directorist-base.php
r2965600 r2974859 4 4 * Plugin URI: https://wpwax.com 5 5 * Description: A comprehensive solution to create professional looking directory site of any kind. Like Yelp, Foursquare, etc. 6 * Version: 7.7. 26 * Version: 7.7. 7 7 * Author: wpWax 8 8 * Author URI: https://wpwax.com -
directorist/trunk/includes/classes/class-email.php
r2957174 r2974859 78 78 } 79 79 if ( empty( $user ) ) { 80 $post_author_id = get_post_field( 'post_author', $listing_id );80 $post_author_id = get_post_field( 'post_author', $listing_id ); 81 81 $user = get_userdata( $post_author_id ); 82 82 } else { … … 954 954 955 955 if ( 'bank_transfer' !== $gateway ) { 956 return false; 956 return false; 957 957 } 958 958 … … 1087 1087 * @return bool Whether the email was sent successfully or not. 1088 1088 */ 1089 public function send_password_reset_pin_email( $listing_email ) { 1090 $s = __( '[==SITE_NAME==] Password Reset PIN', 'directorist' ); 1091 $sub = str_replace( '==SITE_NAME==', get_option( 'blogname' ), $s ); 1092 $pin = random_int( 1000, 9999 ); 1093 1094 $min = 15; 1095 $expiration = 60 * $min; // In seconds 1096 1097 set_transient( "directorist_reset_pin_${listing_email}", $pin, $expiration ); 1098 1099 $body = $this->get_password_reset_pin_email_template(); 1100 $message = $this->replace_in_content( $body, $order_id = 0, $listing_id = 0, $user = null, $renewal = null, $pin ); 1101 $body = atbdp_email_html( $sub, $message ); 1102 1103 return $this->send_mail( $listing_email, $sub, $body, $this->get_email_headers() ); 1104 1089 public function send_password_reset_pin_email( $user ) { 1090 $subject = esc_html( sprintf( __( '[%s] Password Reset PIN', 'directorist' ), get_option( 'blogname' ) ) ); 1091 $user_email = $user->user_email; 1092 $pin_code = directorist_generate_password_reset_pin_code( $user ); 1093 $body = $this->get_password_reset_pin_email_template(); 1094 $message = $this->replace_in_content( $body, 0, 0, $user, null, $pin_code ); 1095 $body = atbdp_email_html( $subject, $message ); 1096 1097 return $this->send_mail( $user_email, $subject, $body, $this->get_email_headers() ); 1105 1098 } 1106 1099 -
directorist/trunk/includes/helper-functions.php
r2957174 r2974859 4120 4120 return ( float ) $item; 4121 4121 } 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 -
directorist/trunk/includes/rest-api/Version1/class-users-account-controller.php
r2628042 r2974859 31 31 public function register_routes() { 32 32 // Send Password Reset PIN 33 33 register_rest_route( $this->namespace, '/' . $this->rest_base . '/send-password-reset-pin', array( 34 34 'methods' => WP_REST_Server::CREATABLE, 35 35 'callback' => array( $this, 'send_password_reset_pin' ), … … 46 46 47 47 // Verify Password Reset PIN 48 48 register_rest_route( $this->namespace, '/' . $this->rest_base . '/verify-password-reset-pin', array( 49 49 'methods' => WP_REST_Server::CREATABLE, 50 50 'callback' => array( $this, 'verify_password_reset_pin' ), … … 66 66 67 67 // Rest user password. 68 68 register_rest_route( $this->namespace, '/' . $this->rest_base . '/reset-user-password', array( 69 69 'methods' => WP_REST_Server::CREATABLE, 70 70 'callback' => array( $this, 'reset_user_password' ), … … 92 92 93 93 // Change password. 94 94 register_rest_route( $this->namespace, '/' . $this->rest_base . '/change-password', array( 95 95 'methods' => WP_REST_Server::CREATABLE, 96 96 'callback' => array( $this, 'change_password' ), … … 168 168 169 169 public function send_password_reset_pin( $request ) { 170 ATBDP()->email->send_password_reset_pin_email( $request['email'] ); 171 172 $data = [ 173 'success' => true, 174 'message' => __( 'Password reset code has been sent to given email.', 'directorist' ), 170 $user = $this->get_user_by_email( $request['email'] ); 171 172 ATBDP()->email->send_password_reset_pin_email( $user ); 173 174 $data = [ 175 'success' => true, 176 'message' => __( 'Password reset code has been sent to your email.', 'directorist' ), 175 177 'email' => $request['email'], 176 178 ]; … … 182 184 183 185 public function verify_password_reset_pin( $request ) { 184 $email = $request['email']; 185 $password_pin = get_transient( "directorist_reset_pin_$email" ); 186 187 if ( empty( $password_pin ) ) { 188 return new WP_Error( 'directorist_rest_password_rest_pin_expired', __( 'Given password reset pin has expired.', 'directorist' ), array( 'status' => 400 ) ); 189 } 190 191 if ( $password_pin != $request['pin'] ) { 192 return new WP_Error( 'directorist_rest_password_rest_pin_invalid', __( 'Invalid password rest pin.', 'directorist' ), array( 'status' => 400 ) ); 193 } 186 $is_valid = $this->validate_reset_pin_code( $request ); 187 188 if ( is_wp_error( $is_valid ) ) { 189 return $is_valid; 190 } 194 191 195 192 $data = [ … … 204 201 205 202 public function reset_user_password( $request ) { 206 $email = $request['email']; 207 $user = get_user_by( 'email', $email ); 208 $password_pin = get_transient( "directorist_reset_pin_$email" ); 209 210 if ( empty( $password_pin ) ) { 211 return new WP_Error( 'directorist_rest_password_rest_pin_expired', __( 'Your password reset pin has expired.', 'directorist' ), array( 'status' => 400 ) ); 212 } 213 214 if ( $password_pin != $request['pin'] ) { 215 return new WP_Error( 'directorist_rest_password_rest_pin_invalid', __( 'Invalid password rest pin.', 'directorist' ), array( 'status' => 400 ) ); 216 } 217 218 // Change Password 219 wp_set_password( $request['password'], $user->ID ); 220 221 // Delete The PIN 222 delete_transient( "directorist_reset_pin_$email" ); 203 $is_valid = $this->validate_reset_pin_code( $request ); 204 205 if ( is_wp_error( $is_valid ) ) { 206 return $is_valid; 207 } 208 209 $user = $this->get_user_by_email( $request['email'] ); 210 211 wp_set_password( $request['password'], $user->ID ); 212 213 directorist_delete_password_reset_code_transient( $user ); 214 delete_user_meta( $user->ID, 'directorist_pasword_reset_key' ); 223 215 224 216 $data = [ … … 241 233 242 234 // Change Password 243 235 wp_set_password( $request['new_password'], $user->ID ); 244 236 245 237 $data = [ … … 252 244 return $response; 253 245 } 246 247 248 249 250 251 252 253 254 255 256 257 258 259 254 260 } -
directorist/trunk/readme.txt
r2965600 r2974859 6 6 Tested up to: 6.3 7 7 Requires PHP: 7.0 8 Stable tag: 7.7. 28 Stable tag: 7.7. 9 9 License: GPLv3 10 10 License URI: https://www.gnu.org/licenses/gpl-3.0.html … … 410 410 411 411 == Changelog == 412 413 414 415 412 416 413 417 7.7.2 - Sep 12, 2023
Note: See TracChangeset
for help on using the changeset viewer.