yapi/static/index.html
2017-07-12 17:01:27 +08:00

39 lines
938 B
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html>
<!-- 将原来的输入用户名和密码表单去掉
<form>
<input name="username">
<input name="password">
</form>
-->
<!-- 添加一个登录按钮 -->
<button id="qsso-login">qsso登录</button>
<!-- 引入qsso auth js库 -->
<script src="https://qsso.corp.qunar.com/lib/qsso-auth.js"></script>
<script>
// 调用QSSO.attach进行登录参数的设置设置绑定登录事件的HTML元素接收token的登录接口URI。
QSSO.attach('qsso-login','/user/login_by_token');
var xhr = new XMLHttpRequest();
xhr.open('GET', '/user/status')
xhr.onload = function(e){
if(this.status == 200){
alert(this.responseText)
}
}
xhr.send()
// attach函数会将HTMLid为qsso-login的元素onclick时自动去qsso登录当用户用户点击上面的button会跳到qsso登录页面,用户在qsso登录后将会把token值post到http://xxx.qunar.com/login.php上。
</script>
<!-- 结束 -->
<html>