Changeset 2575606
- Timestamp:
- 07/31/2021 03:32:37 AM (5 years ago)
- Location:
- servicebot
- Files:
-
- 6 edited
- 1 copied
-
tags/2.1.2 (copied) (copied from servicebot/trunk)
-
tags/2.1.2/public/class-servicebot-public.php (modified) (5 diffs)
-
tags/2.1.2/public/widgets/js/billflow-widget.js (modified) (2 diffs)
-
tags/2.1.2/servicebot.php (modified) (2 diffs)
-
trunk/public/class-servicebot-public.php (modified) (5 diffs)
-
trunk/public/widgets/js/billflow-widget.js (modified) (2 diffs)
-
trunk/servicebot.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
servicebot/tags/2.1.2/public/class-servicebot-public.php
r2575552 r2575606 119 119 } 120 120 121 function billflow_log_in_user($user_id, $email, $user_login, $password ){121 function billflow_log_in_user($user_id, $email, $user_login, $password, $caller){ 122 122 123 123 $wp_auth = wp_authenticate($user_login, $password); … … 128 128 'email' => $email, 129 129 'user_already_exists' => true, 130 'password_match' => false 130 'password_match' => false, 131 'caller' => $caller 131 132 ), 401 ); 132 133 }else{ … … 145 146 'password' => '****************************', 146 147 'login_user_by_password' => true, 147 'refresh'=> true 148 'refresh'=> true, 149 'caller' => $caller 148 150 ), 200 ); 149 151 } 150 152 } 151 153 152 154 /** 155 * create user function called by frontend widget ajax 156 */ 153 157 function servicebot_ajax_create_user() { 154 158 … … 185 189 'name' => $name, 186 190 'password' => '*****', 187 'message' => 'User created successfully .',191 'message' => 'User created successfully by ajax call', 188 192 'refresh' => true 189 193 ), 200 ); 190 194 }else{ 191 // try to fetch the user by email192 $existing_user = get_user_by('email', $email);193 195 // if user already exists 194 196 if($existing_user){ … … 196 198 $user_login = $existing_user->get('user_login'); 197 199 198 // if the user hasn't been updated with a password 199 // this is when the user is just newly created by stripe webhook 200 if(get_user_meta( $user_id, "billflow_stripe_webhook_created", TRUE )){ 201 // and if the user has the matching subscription 202 if(get_user_meta( $user_id, "billflow_stripe_subscription_id", TRUE) === $subscription_id){ 203 // set the password automatically here because the subscription id matches. 204 wp_set_password($password, $user_id); 205 // Login the new user with the provided password 206 billflow_log_in_user($user_id, $email, $user_login, $password); 207 }else{ 208 // if the subscription id doesn't match 209 // still try login the user with the user input password to see if they are the owner 210 // because user exists, but provided a password. 211 billflow_log_in_user($user_id, $email, $user_login, $password); 212 } 213 }else{ 214 // if user exists but not newly created by webhook 215 // because user exists, but provided a password. 216 billflow_log_in_user($user_id, $email, $user_login, $password); 217 } 200 // if user exists but not newly created by webhook 201 // because user exists and provided a password. 202 billflow_log_in_user($user_id, $email, $user_login, $password, 'billflow_login_by_password'); 203 218 204 }else{ 219 205 // WP_Error but not existing user, some other unhandled errors. -
servicebot/tags/2.1.2/public/widgets/js/billflow-widget.js
r2476695 r2575606 68 68 window.location.replace(upgrade_url + "?redirect_to=" + window.location.pathname + window.location.search) 69 69 }else{ 70 // alert("Please add upgrade_url to the billflow shortcode with the upgrade checkout page to send this user to upgrade, otherwise, it goes to home page by default")70 console.error("[BF_ERROR] Please add upgrade_url to the billflow shortcode with the upgrade checkout page to send this user to upgrade, otherwise, it goes to home page by default") 71 71 } 72 72 } … … 139 139 }).done(function(){ 140 140 resolve("created WP user successfully!") 141 }).fail(function(){ 141 }).fail(function(jqXHR, textStatus, errorThrown){ 142 console.error("Billflow WP account creation encountered an error", jqXHR.responseText, textStatus, errorThrown); 142 143 reject("unable to create WP user!") 143 console.error("Billflow WP account creation encountered an error");144 144 }) 145 145 }) -
servicebot/tags/2.1.2/servicebot.php
r2575552 r2575606 17 17 * Plugin URI: http://www.wpexplorer.com/servicebot/ 18 18 * Description: Provides NO-CODE integration between WordPress and Billflow, an UI layer on top of Stripe Billing. 19 * Version: 2.1. 119 * Version: 2.1.2 20 20 * Author: Billflow 21 21 * Author URI: https://billflow.io … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'SERVICEBOT_VERSION', '2.1. 1' );38 define( 'SERVICEBOT_VERSION', '2.1.2' ); 39 39 40 40 /** -
servicebot/trunk/public/class-servicebot-public.php
r2575552 r2575606 119 119 } 120 120 121 function billflow_log_in_user($user_id, $email, $user_login, $password ){121 function billflow_log_in_user($user_id, $email, $user_login, $password, $caller){ 122 122 123 123 $wp_auth = wp_authenticate($user_login, $password); … … 128 128 'email' => $email, 129 129 'user_already_exists' => true, 130 'password_match' => false 130 'password_match' => false, 131 'caller' => $caller 131 132 ), 401 ); 132 133 }else{ … … 145 146 'password' => '****************************', 146 147 'login_user_by_password' => true, 147 'refresh'=> true 148 'refresh'=> true, 149 'caller' => $caller 148 150 ), 200 ); 149 151 } 150 152 } 151 153 152 154 /** 155 * create user function called by frontend widget ajax 156 */ 153 157 function servicebot_ajax_create_user() { 154 158 … … 185 189 'name' => $name, 186 190 'password' => '*****', 187 'message' => 'User created successfully .',191 'message' => 'User created successfully by ajax call', 188 192 'refresh' => true 189 193 ), 200 ); 190 194 }else{ 191 // try to fetch the user by email192 $existing_user = get_user_by('email', $email);193 195 // if user already exists 194 196 if($existing_user){ … … 196 198 $user_login = $existing_user->get('user_login'); 197 199 198 // if the user hasn't been updated with a password 199 // this is when the user is just newly created by stripe webhook 200 if(get_user_meta( $user_id, "billflow_stripe_webhook_created", TRUE )){ 201 // and if the user has the matching subscription 202 if(get_user_meta( $user_id, "billflow_stripe_subscription_id", TRUE) === $subscription_id){ 203 // set the password automatically here because the subscription id matches. 204 wp_set_password($password, $user_id); 205 // Login the new user with the provided password 206 billflow_log_in_user($user_id, $email, $user_login, $password); 207 }else{ 208 // if the subscription id doesn't match 209 // still try login the user with the user input password to see if they are the owner 210 // because user exists, but provided a password. 211 billflow_log_in_user($user_id, $email, $user_login, $password); 212 } 213 }else{ 214 // if user exists but not newly created by webhook 215 // because user exists, but provided a password. 216 billflow_log_in_user($user_id, $email, $user_login, $password); 217 } 200 // if user exists but not newly created by webhook 201 // because user exists and provided a password. 202 billflow_log_in_user($user_id, $email, $user_login, $password, 'billflow_login_by_password'); 203 218 204 }else{ 219 205 // WP_Error but not existing user, some other unhandled errors. -
servicebot/trunk/public/widgets/js/billflow-widget.js
r2476695 r2575606 68 68 window.location.replace(upgrade_url + "?redirect_to=" + window.location.pathname + window.location.search) 69 69 }else{ 70 // alert("Please add upgrade_url to the billflow shortcode with the upgrade checkout page to send this user to upgrade, otherwise, it goes to home page by default")70 console.error("[BF_ERROR] Please add upgrade_url to the billflow shortcode with the upgrade checkout page to send this user to upgrade, otherwise, it goes to home page by default") 71 71 } 72 72 } … … 139 139 }).done(function(){ 140 140 resolve("created WP user successfully!") 141 }).fail(function(){ 141 }).fail(function(jqXHR, textStatus, errorThrown){ 142 console.error("Billflow WP account creation encountered an error", jqXHR.responseText, textStatus, errorThrown); 142 143 reject("unable to create WP user!") 143 console.error("Billflow WP account creation encountered an error");144 144 }) 145 145 }) -
servicebot/trunk/servicebot.php
r2575552 r2575606 17 17 * Plugin URI: http://www.wpexplorer.com/servicebot/ 18 18 * Description: Provides NO-CODE integration between WordPress and Billflow, an UI layer on top of Stripe Billing. 19 * Version: 2.1. 119 * Version: 2.1.2 20 20 * Author: Billflow 21 21 * Author URI: https://billflow.io … … 36 36 * Rename this for your plugin and update it as you release new versions. 37 37 */ 38 define( 'SERVICEBOT_VERSION', '2.1. 1' );38 define( 'SERVICEBOT_VERSION', '2.1.2' ); 39 39 40 40 /**
Note: See TracChangeset
for help on using the changeset viewer.