How Web authentication release different operating systems

In WFilter NGF (WSG online behavior management gateway) of "Web Authentication" configuration, you can configure the client to be authenticated Web-based IP range. Actual use, some wireless local area network computer and mobile phone terminals are mixed in the same network segment, in which case, if you want the computer to do only authentication, or authentication only phone to do, can not be achieved by IP range. You need to modify the default authentication page, to get the client operating system based on the type of browser useragent, and determine whether to release (immediate release without authentication).

The figure below, click "Edit Web authentication page" and then click on the icon in the source code.

201908131565677101864630.png

You can view the Web authentication interface source code.

201908131565677203111754.png

Which added a function, as follows:

function checkbypassPC(){
    //alert("userAgent="+window.navigator.userAgent);
    if( window.navigator.userAgent != undefined && window.navigator.userAgent.indexOf("Windows") > -1 ){

       // If the windows system, automatic bypass.

        $.ajax( "/cgi-bin/verify?tid=bypasspc", {
            method: 'GET',
            cache: false,
            dataType: 'text',
            success: function(data) {

               //跳转到成功认证的跳转页面
                check_landing_page();
            }
        });
    }
}

如下图:

201908131565677469529702.png

然后切换到编辑模式下点击保存。(注意:不要在源代码模式下保存)

经过上述配置后,在pc端跳出认证页面后即可自动完成认证,无需进行扫码。如果要对手机不进行认证,直接在函数中修改useragent即可,如下:

function checkbypassPC(){
    //alert("userAgent="+window.navigator.userAgent);

   if( /Android|webOS|iPhone|iPad|iPod|Opera Mini/i.test(window.navigator.userAgent) ) {
        //Android、iphone、ipad自动bypass。

        $.ajax( "/cgi-bin/verify?tid=bypasspc", {
            method: 'GET',
            cache: false,
            dataType: 'text',
            success: function(data) {

               // Jump to jump successfully authenticated page
                check_landing_page ();
            }
        });

   }

}


Guess you like

Origin blog.51cto.com/12800391/2429534