wifi免密碼登錄認證流程


 

您查詢的關鍵詞是: weixin: , qr gex_zm- 以下是該網頁在北京時間 2016年03月27日 02:46:42 的快照;

如果打開速度慢,可以嘗試快速版;如果想保存快照,可以添加到搜藏;如果想更新或刪除快照,可以投訴快照

百度和網頁  http://c.anywifi.com/wiki/user/auth.html 的作者無關,不對其內容負責。百度快照謹為網絡故障時之索引,不代表被搜索網站的即時頁面。
 

用戶登陸接口

[Access Authorization]

 在我們的設備固件制作過程中我們使用了與大多數電信運營商相同的 Portal認證 技術其中系統架構上主要由 AP無線訪問接入點(Wireless Access Point)AC接入控制器(Wireless Access Point Controller)認證頁面服務器(Captive Portal Server)認證計費服務器(Cloud Radius Server)構成而在雲端我們完成了Portal頁面的雲存儲Captive Portal頁面在線編輯Portal靜態文件CDN加速以及上網用戶數據的分析展示同時radius服務器也通過Oauth2.0協議與第三方賬戶系統的打通。

Portal認證:

portal authentication

您需要做什么?

您只需要完成 Portal頁面 與 AC接入控制器(路由器) 的局域網通信即可而在路由器固件中我們配置的 Radius客戶端 將代替網絡接入請求者向 認證計費服務器 發送認證請求返回認證結果。

Portal頁面 與 AC接入控制器(路由器) 之間的通信是通過json Api 完成的為了方便您的快速開發我們提供了Javascript Library您只需要引入制定JS文件通過簡單的編寫Javascript代碼即可自定義您的賬戶認證而這一切都可以通過 在線編輯代碼 完成。

您應該怎樣去做?

一、 編輯認證頁面模板引入JS文件

<script src="http://s.anywifi.com/resources/anywifiLibrary.js"></script>

注意:請不要下載保存該文件我們將不定期更新完善該Library.

二、 幾種常用認證方式

1、匿名登陸(訪客模式)

匿名登陸接口函數:anonymousLogin();

在上網用戶未通過認證前可以通過 訪客模式 獲取短暫的網絡接入權限或者您只需要訪客 點擊某鏈接即可上網 在這里即可使用匿名登陸實現(匿名登陸獲取的網絡接入 時常帶寬 均可在管理平台上網用戶-用戶組 中進行設置)。

示例

<!doctype html>
<html>
<head>
<title>{title}</title>
<script src="http://s.anywifi.com/resources/anywifiLibrary.js"></script>
</head>
<body>
<a href="anonymousLogin();">匿名登陸</a>
<p>點擊上面鏈接即可免費上網。</p>
</body>
</html>

當然你也可以利用JS的定時器來顯示打開頁面(點擊按鈕)N秒后自動登陸效果如下:

WIFI倒計時自動登陸

代碼如下:

<!doctype html>
<html>
<head>
<title>{title}</title>
<script src="http://s.anywifi.com/resources/anywifiLibrary.js"></script>
<script type="text/javascript">
function timer(){
   var i = 10;
   $("#dt2").show();
   $("#dt1").hide();
   var ttt = window.setInterval(function(){
            i--;
            $("#time").html(i);
            if(i==0){
                   clearInterval(ttt);
                   anonymousLogin();
            }
        }, 1000);
}
</script>
</head>
<body>
<dl>
    <dt id="dt1">
        <a href="javascript:void(0)" onclick="timer();"><span>1</span><span>點擊試用免費WIFI</span></a>
    </dt>
    <dt id="dt2" style="display:none;">
        <a href="javascript:void(0)"><span>1</span><span>上網配置中<em  id="time">10</em></span></a>
    </dt>
</dl>
</body>
</html>

2、微信登陸

微信登陸接口地址:http://c.anywifi.com/api/weixinlogin?uid=<平台賬戶UID>(“<平台賬戶UID>”需要 <a "http:="" c.anywifi.com="" user="" login.html"="" target="_blank">登陸平台 后顯示)

上述微信登陸接口地址適用於在上網 認證頁面 提示用戶 關注某微信賬戶然后微信賬戶在用戶關注后自動回復 該地址鏈接用戶使用微信點擊此鏈接時則將自動調用JS微信登陸接口函數完成 微信一鍵關注上網 如果不是在微信中訪問的此API地址則將會出現請打開微信客戶端的 提示

微信一鍵關注上網

微信一鍵關注上網登陸成功    微信一鍵關注上網登陸失敗

微信登陸接口函數:webchatLogin();

獲取頁面推廣微信賬戶:http://c.anywifi.com/api/weixinname?nasid=[NASID](NASID 參數可以從URL的GET查詢字符串中獲取)

微信登陸接口函數 是區別於 匿名登陸接口的主要是因為管理平台可以對兩種用戶組分別設置不同的 時常帶寬組別屬性微信登陸接口我們通常利用微信瀏覽器的UA( 微信瀏覽器User-Agent )的特殊性來判斷是否是在微信瀏覽器中點擊此鏈接查看此頁面決定是否予以網絡接入上面提到的 微信關注一鍵上網接口 就是采用該思路實現的。

示例

<!doctype html>
<html>
<head>
<title>{title}</title>
<script src="http://s.anywifi.com/resources/anywifiLibrary.js"></script>
<script type="text/javascript">
//通過查詢字符串中的NASID判斷查詢該設備認證頁面需要推廣的微信賬號
var nasId = getQueryString('nasid');
ajaxLoad("GET","http://c.anywifi.com/api/weixinname?nasid="+nasId+"&t="+Math.random(),function(){
	if (xmlhttp.readyState==4 && xmlhttp.status==200){
		getel('wx_name').innerHTML = xmlhttp.responseText;
	}
});
});
</script>
</head>
<body>
<div class="gridContainer clearfix" id="forpc" style="display:none;">
  <div id="div1" class="fluid wrapper test transition">
  	<h1 id="logo" class="test"><img class="lo_ico" src="http://s.anywifi.com/resources/template/1/webchatonekeylogin/warnico.png"></h1>
  	<div class="notecont transition">
      <h2>WebChat Only</h2>
      <a class="golink" href="weixin://qr/gEx_Zm-EdTlKrSsF9xmS">關注微信<span id="wx_name"></span>認證上網</a>
  	</div>
  </div>
</div>
<div class="gridContainer clearfix" id="forweixin" style="display:none;">
  <div id="div1" class="fluid wrapper test transition">
  	<h1 id="logo" class="test"><img class="lo_ico" src="http://s.anywifi.com/resources/template/1/webchatonekeylogin/successico.png"></h1>
  	<div class="notecont transition">
      <h2>登陸成功</h2>
  	</div>
  </div>
</div>
<script type="text/javascript">
//根據UA判斷
var ua = navigator.userAgent.toLowerCase();
var url = window.location.href;
if(ua.indexOf("android")!=-1 || ua.indexOf("iphone")!=-1 || ua.indexOf("ipad")!=-1 || ua.indexOf("phone")!=-1){ //mobile end
    //micromessenger
    if(ua.indexOf("micromessenger")!=-1){
        getel('forweixin').style.display='block';
        setTimeout("webchatLogin()",2000);
    }else {
        getel('forpc').style.display='block';
    }
}else{
    getel('forpc').style.display='block';
}
</script>
</body>
</html>

3、手機號碼登陸

手機號登陸接口函數:userLogin(mobilephone,password);

獲取登陸驗證碼:http://c.anywifi.com/api/mobilephone?nasid=[NASID]&mobilephone=[MOBILEPHONE]&mac=[MAC]&ap=[AP]
      (其中NASID、MOBILEPHONE、MAC、AP參數均可從表單或者查詢字符串中獲取)

使用手機號碼作為賬號登陸上網用戶需要填寫 手機號碼通過請求獲取手機號碼驗證密碼然后填入 驗證密碼 即可登陸(獲取驗證密碼需要下行短信注冊賬戶默認贈送50條可以通過平台賬戶購買短信上網用戶手機號碼信息可以從后台瀏覽查看)

手機號碼登陸

手機號碼登陸

示例代碼

<!doctype html>
<html>
<head>
<title>{title}</title>
<script src="http://s.anywifi.com/resources/anywifiLibrary.js"></script>
<script type="text/javascript">
//登陸按鈕
function doLogin(){
	userLogin(getel("phone").value,getel("code").value);
};
//獲取短信驗證密碼
function getPhoneCode(){
    var nasId = getQueryString('nasid');
    var mac = getQueryString('mac');
    var ap = getQueryString('called');
    var mobilePhone = getel("phone").value;
    if(/^1\d{10}$/g.test(mobilePhone)){
        ajaxLoad("GET","http://"+adminDomain+"/api/mobilephone?nasid="+nasId+"&mobilephone="+mobilePhone+"&mac="+mac+"&ap="+ap+"&t="+Math.random(),function(){
            if (xmlhttp.readyState==4 && xmlhttp.status==200){
                if(xmlhttp.responseText=="SUCCESS"){
                    alert('短信驗證碼已發送');
                }else if(xmlhttp.responseText=="OVERLOAD"){
                    alert('短信發送中,請稍等...');
                }else{
                    alert(xmlhttp.responseText);
                }
            }
        });
    }else{
        alert('手機號碼格式不正確');
        getel("phone").value = '';
    }
}
</script>
</head>
<body>
  <div >
    <input type="text" id="phone"  placeholder="輸入手機號" />
    <button id="codeButton" onclick="getPhoneCode();" >獲取驗證碼</button>
  </div>
  <div >
    <input type="text" id="code"  placeholder="輸入驗證碼" />
    <button id="accordion-longinBtn2" onclick="doLogin();" >登 錄</button>
  </div>
</body>
</html>


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM