added login / logout

prepared static IP storage and disable inverter
IMPORTANT: new memory layout, your inverter settings will be lost
This commit is contained in:
lumapu 2022-11-02 22:41:31 +01:00
parent 56b8096bed
commit 6a6d522d3b
11 changed files with 290 additions and 31 deletions

View file

@ -0,0 +1,42 @@
<!doctype html>
<html>
<head>
<title>Login</title>
<link rel="stylesheet" type="text/css" href="style.css"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="api.js"></script>
</head>
<body>
<div id="wrapper">
<div id="login">
<div class="pad">
<form action="/login" method="post">
<h2>AhoyDTU</h2>
<input type="password" name="pwd" value="">
<input type="submit" name="login" value="login" class="btn">
</form>
</div>
</div>
</div>
<div id="footer">
<div class="left">
<a href="https://ahoydtu.de" target="_blank">AhoyDTU &copy 2022</a>
<ul>
<li><a href="https://discord.gg/WzhxEY62mB" target="_blank">Discord</a></li>
<li><a href="https://github.com/lumapu/ahoy" target="_blank">Github</a></li>
</ul>
</div>
<div class="right">
<span id="version"></span><br/><br/>
<a href="https://creativecommons.org/licenses/by-nc-sa/3.0/de" target="_blank" >CC BY-NC-SA 3.0</a>
</div>
</div>
<script type="text/javascript">
function parse(obj) {
parseVersion(obj["system"]);
}
getAjax("/api/index", parse);
</script>
</body>
</html>

View file

@ -36,6 +36,8 @@
<legend class="des">Device Host Name</legend>
<label for="device">Device Name</label>
<input type="text" name="device" class="text"/>
<label for="adminpwd">Admin Password</label>
<input type="password" name="adminpwd" class="text" value="{PWD}"/>
<input type="hidden" name="disclaimer" value="false" id="disclaimer">
</fieldset>

View file

@ -414,3 +414,26 @@ div.ModPwr, div.ModName {
display: inline-block;
margin-top: 15px;
}
#login {
width: 300px;
height: 200px;
border: 1px solid #ccc;
background-color: #eee;
position: absolute;
top: 50%;
left: 50%;
margin-top: -160px;
margin-left: -150px;
}
#login .pad {
padding: 20px;
}
#login .pad input {
width: 100%;
padding: 7px 0 7px 0;
border: 0px;
margin-bottom: 10px;
}

View file

@ -17,11 +17,7 @@
<div id="topnav" class="hide"></div>
</div>
<div id="wrapper">
<div id="content">
<a href="/factory" class="btn">Factory Reset</a><br/>
<br/>
<a href="/reboot" class="btn">Reboot</a>
</div>
<div id="content"></div>
</div>
<div id="footer">
<div class="left">
@ -45,10 +41,19 @@
if(null != obj) {
parseMenu(obj["menu"]);
parseSys(obj["system"]);
var e = document.getElementById("content");
e.innerHTML = obj["html"];
if(null != obj["refresh"]) {
var meta = document.createElement('meta');
meta.httpEquiv = "refresh"
meta.content = obj["refresh"] + "; URL=" + obj["refresh_url"];
document.getElementsByTagName('head')[0].appendChild(meta);
}
}
}
getAjax("/api/index", parse);
getAjax("/api" + window.location.pathname, parse);
</script>
</body>
</html>