Changeset 2554858
- Timestamp:
- 06/28/2021 01:59:19 AM (5 years ago)
- Location:
- vaptcha/trunk
- Files:
-
- 4 edited
-
VaptchaPlugin.php (modified) (9 diffs)
-
js/init-vaptcha.js (modified) (1 diff)
-
lib/Vaptcha.class.php (modified) (4 diffs)
-
options.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
vaptcha/trunk/VaptchaPlugin.php
r2512016 r2554858 41 41 $style = get_option('vaptcha_options')['button_style']; 42 42 $height = $height ? $height : '36px'; 43 $area = get_option('vaptcha_options')['vaptcha_area']; 43 44 $options = json_encode(Array( 44 45 "vid" => $vid, … … 48 49 "https" => true, 49 50 "color" => $color, 51 "area" => $area, 50 52 "offline_server" => site_url() . '/wp-json/vaptcha/offline', 51 53 // 'mode' => 'offline', … … 126 128 } 127 129 $token = sanitize_text_field( $_POST['vaptcha_token'] ); 128 if (!$token || !$this->vaptcha->validate($challenge, $token)) { 130 $server = sanitize_text_field( $_POST['vaptcha_server'] ); 131 if (!$token || !$this->vaptcha->validate($server,$challenge, $token)) { 129 132 wp_die(__('人机验证未通过'.$token, 'vaptcha')); 130 133 } … … 148 151 } 149 152 $token = sanitize_text_field( $_POST['vaptcha_token'] ); 150 if (!$token || !$this->vaptcha->validate($challenge, $token)) { 153 $server = sanitize_text_field( $_POST['vaptcha_server'] ); 154 if (!$token || !$this->vaptcha->validate($server,$challenge, $token)) { 151 155 return new WP_Error('broke', __('人机验证未通过', 'vaptcha')); 152 156 } … … 167 171 } 168 172 $token = sanitize_text_field( $_POST['vaptcha_token'] ); 169 if (!$token || !$this->vaptcha->validate($challenge, $token)) { 173 $server = sanitize_text_field( $_POST['vaptcha_server'] ); 174 if (!$token || !$this->vaptcha->validate($server,$challenge, $token)) { 170 175 $errors->add('captcha_wrong', "<strong>ERROR</strong>:".__('人机验证未通过', 'vaptcha')); 171 176 } … … 184 189 $validated['vaptcha_login'] = ($input['vaptcha_login'] == "1" ? "1" : "0"); 185 190 $validated['vaptcha_lang'] = sanitize_text_field($input['vaptcha_lang']); 191 $validated['vaptcha_area'] = sanitize_text_field($input['vaptcha_area']); 186 192 $validated['bg_color'] = sanitize_text_field($input['bg_color']); 187 193 $validated['vaptcha_width'] = sanitize_text_field($input['vaptcha_width']); … … 209 215 'vaptcha_login' => '1', 210 216 'vaptcha_lang' => 'auto', 217 'vaptcha_area' => 'auto', 211 218 'bg_color' => '#57ABFF', 212 219 'vaptcha_width' => '200', … … 247 254 function captcha_validate_woocommerce($errors) { 248 255 $token = $_POST['vaptcha_token']; 249 if (!$token || !$this->vaptcha->validate($challenge, $token)) { 256 $server = sanitize_text_field( $_POST['vaptcha_server'] ); 257 if (!$token || !$this->vaptcha->validate($server,'', $token)) { 250 258 $errors->add('captcha_wrong', __('人机验证未通过', 'vaptcha')); 251 259 } … … 255 263 function captcha_validate_woocommerce_allow($data) { 256 264 $token = $_POST['vaptcha_token']; 257 if (!$token || !$this->vaptcha->validate($challenge, $token)) { 265 $server = sanitize_text_field( $_POST['vaptcha_server'] ); 266 if (!$token || !$this->vaptcha->validate($server,'', $token)) { 258 267 return new WP_Error('captcha_wrong', __('人机验证未通过', 'vaptcha')); 259 268 } -
vaptcha/trunk/js/init-vaptcha.js
r2303059 r2554858 6 6 script = document.createElement('script'); 7 7 protocol = 'https'; //options.https ? 'https' : 'http'; 8 script.src = protocol + '://v .vaptcha.com/v3.js';8 script.src = protocol + '://v-na.vaptcha.com/v3.js'; 9 9 script.id = 'vaptcha_v_js'; 10 10 script.async = true -
vaptcha/trunk/lib/Vaptcha.class.php
r2308331 r2554858 79 79 * @return void 80 80 */ 81 public function validate($ knock, $token, $sceneId = 0)81 public function validate($server,$knock, $token, $sceneId = 0) 82 82 { 83 83 $str = 'ffline-'; … … 85 85 return $this->downTimeValidate($token); 86 86 else 87 return $this->normalValidate($ knock, $token, $sceneId);87 return $this->normalValidate($server,$knock, $token, $sceneId); 88 88 } 89 89 … … 238 238 } 239 239 240 private function normalValidate($ knock, $token, $sceneId)240 private function normalValidate($server,$knock, $token, $sceneId) 241 241 { 242 242 if (!$token) … … 244 244 $ip = $this->getClientIp(); 245 245 $query = "id=$this->vid&scene=$sceneId&secretkey=$this->key&token=$token&ip=$ip"; 246 $url = $ this->config['API_URL'].$this->config['VALIDATE_URL'].'?' . $query;246 $url = $server.'?' . $query; 247 247 $now = $this->getCurrentTime(); 248 248 $response = json_decode(self::postValidate($url, $query)); -
vaptcha/trunk/options.php
r2341471 r2554858 129 129 </td> 130 130 </tr> 131 <tr> 132 <th><label for="public_key_text"><?php _e('验证节点', 'vaptcha') ?></label></th> 133 <td> 134 <fieldset> 135 <select name="vaptcha_options[vaptcha_area]"> 136 <option value=" " <?php selected( $options['vaptcha_area'], ' ' ); ?>>中国大陆</option> 137 <option value="en" <?php selected( $options['vaptcha_area'], 'sea' ); ?>>东南亚</option> 138 <option value="zh-CN" <?php selected( $options['vaptcha_area'], 'na' ); ?>>北美</option> 139 <option value="zh-TW" <?php selected( $options['vaptcha_area'], 'cn' ); ?>>欧洲</option> 140 </select> 141 </fieldset> 142 </td> 143 </tr> 131 144 </tbody> 132 145 </table>
Note: See TracChangeset
for help on using the changeset viewer.