elasticsearch-head设置登录用户和密码

论坛 期权论坛 编程之家     
选择匿名的用户   2021-5-29 02:30   33   0

将elasticsearch-head-master/index.html路径下的index.html文件替换为如下代码,userName和userPassword自定义

<!DOCTYPE html>
 
<html>
<head>
<meta charset="UTF-8">
<title>elasticsearch-head</title>
<link rel="stylesheet" href="_site/base/reset.css">
<link rel="stylesheet" href="_site/vendor.css">
<link rel="stylesheet" href="_site/app.css">
<script src="_site/i18n.js" data-baseDir="_site/lang" data-langs="en,fr,pt,zh,tr,ja"></script>
<script src="_site/vendor.js"></script>
<script src="_site/app.js"></script>
<script>
var loginClick = function() {
if(document.getElementById("userName").value!="*****" || document.getElementById("userPassword").value!="******"){
                   document.getElementById("isNotVerified").style.display="block";
                   return;
} else {
document.getElementById("loginDiv").style.display="none";
}
if(location.href.contains("/_plugin/")) {
var base_uri = location.href.replace(/_plugin\/.*/, '');
}
var args = location.search.substring(1).split("&").reduce(function(r, p) {
r[decodeURIComponent(p.split("=")[0])] = decodeURIComponent(p.split("=")[1]); return r;
}, {});
new app.App("body", {
id: "es",
base_uri: args["base_uri"] || base_uri,
auth_user : args["auth_user"] || "",
auth_password : args["auth_password"],
dashboard: args["dashboard"]
});
};
</script>
<link rel="icon" href="base/favicon.png" type="image/png">
</head>
<body>
<div width="100%" name="loginDiv" id="loginDiv" style="text-align: center;">
<div width="100%" style="text-align: center;">登录<br></div>
            <div width="100%" style="text-align: center;">用户名:<input type="text" name="userName" id="userName"></div><br>
            <div width="100%" style="text-align: center;">密 码:<input type="password" name="userPassword" id="userPassword"></div><br>
            <div width="100%" style="text-align: center;"><button onclick="loginClick();">确定</button></div><br>
            <div width="100%" id="isNotVerified" style="text-align: center;display: none"><font color="red">用户名或密码输入不正确</font></div><br>
</div>
</body>
</html>

分享到 :
0 人收藏
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

积分:3875789
帖子:775174
精华:0
期权论坛 期权论坛
发布
内容

下载期权论坛手机APP