Changeset 3329968
- Timestamp:
- 07/18/2025 12:50:12 AM (9 months ago)
- Location:
- qe-fid-id/trunk
- Files:
-
- 5 edited
-
autoload.php (modified) (1 diff)
-
includes/Endpoint/PluginAdmin.php (modified) (1 diff)
-
includes/Plugin.php (modified) (1 diff)
-
qe-fid-plugin.php (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
qe-fid-id/trunk/autoload.php
r3325299 r3329968 3 3 namespace QeFid\ID; 4 4 5 define('QE_FID_VERSION', '1.3. 1');5 define('QE_FID_VERSION', '1.3.2'); 6 6 7 7 /** -
qe-fid-id/trunk/includes/Endpoint/PluginAdmin.php
r3325299 r3329968 107 107 } 108 108 109 if ($tokens->is_license_expired()) { 110 if ($tokens->is_license_within_grace_period()) { 111 $result = static::refresh_license_tokens(true); 112 if ($result['success']) { 113 error_log("License renewed successfully within grace period"); 114 return; 115 } 116 error_log("Failed to renew license within grace period: " . json_encode($result['error'])); 109 if (static::handle_expired_license($tokens)) { 110 return; 111 } 112 113 if (static::attempt_refresh_pair($tokens)) { 114 return; 115 } 116 117 static::attempt_refresh_access($tokens); 118 119 static::update_license_expiration($tokens); 120 } 121 122 /** 123 * Handles an expired license, attempting renewal within grace period if applicable. 124 * 125 * @param Tokens $tokens The token instance. 126 * @return bool True if the expiry was handled (deactivated or failed renewal), false if renewed successfully. 127 */ 128 private static function handle_expired_license(Tokens $tokens) 129 { 130 if (!$tokens->is_license_expired()) { 131 return false; 132 } 133 134 if ($tokens->is_license_within_grace_period()) { 135 $result = static::refresh_license_tokens(true); 136 if ($result['success']) { 137 error_log("License renewed successfully within grace period"); 138 self::redeploy_license_check(); 139 return false; // Renewed; continue with further checks 117 140 } 118 static::get_instance()->remove_token_expiry_check(); 119 (new LoginMonitor)->log_custom_message("License Expired", "Please renew"); 120 PluginAdmin::deactivate_license($tokens->get_refresh_token()); 121 return; 122 } 123 124 if ($tokens->can_renew_refresh_token() || $tokens->is_license_within_grace_period()) { 125 $result = static::refresh_license_tokens(true); 126 if (isset($result['error']) && $result['success'] === false) { 127 error_log("Refresh failed: " . json_encode($result['error'])); 128 return; 129 } 130 } elseif ($tokens->can_renew_access_token() && !$tokens->is_refresh_token_expired()) { 131 $result = static::refresh_license_tokens(); 132 if (isset($result['error']) && $result['success'] === false) { 133 error_log("Access token refresh failed: " . json_encode($result['error'])); 134 return; 135 } 136 } 137 141 error_log("Failed to renew license within grace period: " . json_encode($result['error'])); 142 } 143 144 static::get_instance()->remove_token_expiry_check(); 145 (new LoginMonitor())->log_custom_message("License Expired", "Please renew"); 146 PluginAdmin::deactivate_license($tokens->get_refresh_token()); 147 return true; // Handled by deactivation; early return 148 } 149 150 /** 151 * Attempts to refresh the token pair if conditions are met. 152 * 153 * @param Tokens $tokens The token instance. 154 * @return bool True if refresh failed (early return), false if successful or not attempted. 155 */ 156 private static function attempt_refresh_pair(Tokens $tokens) 157 { 158 if (!$tokens->can_renew_refresh_token() && !$tokens->is_license_within_grace_period()) { 159 return false; 160 } 161 162 $result = static::refresh_license_tokens(true); 163 if (isset($result['error']) && $result['success'] === false) { 164 error_log("Refresh failed: " . json_encode($result['error'])); 165 return true; // Failed; early return 166 } 167 168 self::redeploy_license_check(); 169 return false; // Successful; continue 170 } 171 172 /** 173 * Attempts to refresh the access token if conditions are met. 174 * 175 * @param Tokens $tokens The token instance. 176 * @return void 177 */ 178 private static function attempt_refresh_access(Tokens $tokens) 179 { 180 if (!$tokens->can_renew_access_token() || $tokens->is_refresh_token_expired()) { 181 return; 182 } 183 184 $result = static::refresh_license_tokens(); 185 if (isset($result['error']) && $result['success'] === false) { 186 error_log("Access token refresh failed: " . json_encode($result['error'])); 187 return; 188 } 189 190 self::redeploy_license_check(); 191 } 192 193 /** 194 * Updates the stored license expiration time based on token claims. 195 * 196 * @param Tokens $tokens The token instance. 197 * @return void 198 */ 199 private static function update_license_expiration(Tokens $tokens) 200 { 138 201 $hard_exp = $tokens->get_refresh_claim('hard_exp') ?: $tokens->get_refresh_claim('exp'); 139 202 if (!empty($hard_exp) && is_numeric($hard_exp)) { -
qe-fid-id/trunk/includes/Plugin.php
r3325299 r3329968 58 58 * 59 59 */ 60 protected $plugin_version = "1.3. 1";60 protected $plugin_version = "1.3.2"; 61 61 62 62 /** -
qe-fid-id/trunk/qe-fid-plugin.php
r3325299 r3329968 15 15 * Plugin URI: https://www.fidaccess.com 16 16 * Description: Secure your wp-admin with Facial recognition technology powered by FiD Access 17 * Version: 1.3. 117 * Version: 1.3.2 18 18 * Author: FiD Access 19 19 * Text Domain: qe-fid-v1 -
qe-fid-id/trunk/readme.txt
r3325299 r3329968 5 5 Tested up to: 6.7.2 6 6 Requires PHP: 5.6 7 Stable tag: 1.3. 17 Stable tag: 1.3.2 8 8 License: GPL-3.0 or later 9 9 License URI: https://www.gnu.org/licenses/gpl.html … … 190 190 191 191 == Changelog == 192 = 1.3.2 = 193 - Minor fixes clean cron jobs 194 = 1.3.1 = 195 - Minor stability fixes 192 196 = 1.3.0 = 193 197 - Minor fixes for renewing licenses
Note: See TracChangeset
for help on using the changeset viewer.