Plugin Directory

Changeset 2586935


Ignore:
Timestamp:
08/23/2021 08:46:38 AM (5 years ago)
Author:
vaptcha
Message:

更新设备校验和设备登录

Location:
vaptcha-sms/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vaptcha-sms/trunk/VaptchaSmsPlugin.php

    r2557559 r2586935  
    560560    public function load_sms_js()
    561561    {
    562         wp_register_script('vaptcha_sms_js', plugins_url('js/sms.js', __FILE__), array('jquery'), '1.1', true);
     562        wp_register_script('vaptcha_sms_js', plugins_url('js/sms.js', __FILE__), array('jquery'), '3.3.2', true);
    563563        wp_enqueue_script('vaptcha_sms_js');
    564564
    565         wp_register_script('vaptcha_v3_js', 'https://v-na.vaptcha.com/v3.js', array('jquery'), '1.1', true);
     565        wp_register_script('vaptcha_v3_js', 'https://v-na.vaptcha.com/v3.js', array('jquery'), '3.3.2', true);
    566566        wp_enqueue_script('vaptcha_v3_js');
    567567    }
     
    685685            wp_send_json_error(array('code' => 444, 'msg' => '人机验证未通过'));
    686686        }
    687         $url = 'https://auth.vaptcha.com/api/v1/device?id=' . $phone . '&token=' . $token . '&renewal=1';
     687        $url = $server.'/device?id=' . $phone . '&token=' . $token . '&renewal=1';
    688688        $response = wp_remote_get($url);
    689689
     
    702702        $vcode = sanitize_text_field($_POST['code']);
    703703        $token = sanitize_text_field($_POST['token']);
     704        $server = sanitize_text_field($_POST['server']);
    704705//        $server = sanitize_text_field($_POST['server']);
    705706        //通过手机号查找用户
     
    726727        $data = array(
    727728            'id' => $phone,
    728             'token' => $token
     729            'token' => $token,
     730            'regedit' => 0
    729731        );
    730         $url = 'https://auth.vaptcha.com/api/v1/device';
     732        $url =  $server.'/device';
    731733        $args = array(
    732734            'method' => 'PUT',
    733             'body' => $data,
     735            'body' => json_encode($data),
    734736            'timeout' => '5',
    735737            'redirection' => '5',
  • vaptcha-sms/trunk/js/sms.js

    r2557559 r2586935  
    9292    })
    9393
    94     var smsToken = '';
     94    var smsTokenServer = '';
    9595    //发送验证码
    9696    function sendSmsCode(token, key) {
     
    110110            success: function (res) {
    111111                if (res.data === 200) {
    112                     smsToken = token.token
     112                    smsTokenServer = token
    113113                    key === 'register' ? sendCountdown() : loginSendCountdown()
    114114                } else {
     
    239239                action: 'add_device',
    240240                phone: $('#user_phone').val(),
    241                 token: token,
     241                token: token.token,
     242                server:token.server,
    242243                smsid: smsid,
    243244                code: $('#sms_code').val()
     
    346347    $('#sms_login_button').click(function () {
    347348        operaticon = 'smsLogin';
    348         addDevice(smsToken)
     349        addDevice(smsTokenServer)
    349350        // obj.validate()
    350351    })
Note: See TracChangeset for help on using the changeset viewer.