mirror of
https://github.com/yhl452493373/frps-panel.git
synced 2026-04-04 06:16:59 +08:00
http basic auth by jq(not complete)
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-username"></i>
|
||||
</div>
|
||||
<input type="text" name="username" value="" lay-verify="required" placeholder="用户名"
|
||||
<input type="text" id="username" value="" lay-verify="required" placeholder="用户名"
|
||||
lay-reqtext="请填写用户名" autocomplete="off" class="layui-input" lay-affix="clear">
|
||||
</div>
|
||||
</div>
|
||||
@@ -31,7 +31,7 @@
|
||||
<div class="layui-input-prefix">
|
||||
<i class="layui-icon layui-icon-password"></i>
|
||||
</div>
|
||||
<input type="password" name="password" value="" lay-verify="required" placeholder="密码"
|
||||
<input type="password" id="password" value="" lay-verify="required" placeholder="密码"
|
||||
lay-reqtext="请填写密码" autocomplete="off" class="layui-input" lay-affix="eye">
|
||||
</div>
|
||||
</div>
|
||||
@@ -46,13 +46,18 @@
|
||||
$(function () {
|
||||
$('#login').click(function () {
|
||||
$.ajax({
|
||||
url: "/login",
|
||||
type: "post",
|
||||
header: {
|
||||
Authorization: btoa("admin" + ":" + "admin")
|
||||
},
|
||||
url: "/",
|
||||
username: $('#username').val(),
|
||||
password: $('#password').val(),
|
||||
success: function (result) {
|
||||
console.log(result);
|
||||
window.location.href = "/"
|
||||
},
|
||||
error: function (xhr, status, error) {
|
||||
if (xhr.status === 401) {
|
||||
layui.layer.msg('用户名或密码错误');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user