64 lines
1.9 KiB
Plaintext
64 lines
1.9 KiB
Plaintext
<%- include('./static/start.ejs',{name:'login',async: true}) %>
|
|
|
|
<style>
|
|
* {
|
|
text-align: center;
|
|
}
|
|
iframe{
|
|
border: 0px;
|
|
display: none;
|
|
}
|
|
</style>
|
|
|
|
<form action="" method="post" id="log_form">
|
|
<div class="login-page">
|
|
<input name="login" type="text" id="login" required>
|
|
<label for="login">login</label>
|
|
</div>
|
|
<div class="pass-page">
|
|
<input name="pass" type="password" id="pass" value="" required>
|
|
<label for="pass">password</label>
|
|
</div>
|
|
|
|
<button type="button" id="log_btn" onclick="log(document.getElementById('login').value,document.getElementById('pass').value);">login</button>
|
|
<!-- <input type="submit" value="" hidden> -->
|
|
<div id="res"></div>
|
|
|
|
</form>
|
|
|
|
<%- include('./static/end.ejs') %>
|
|
|
|
<script>
|
|
// console.log($.cookie("uuid"));
|
|
// log_by_sid();
|
|
|
|
function log(nlogin,npass){
|
|
const login = CryptoJS.AES.encrypt(nlogin,$.cookie("sid")).toString();
|
|
const pass = CryptoJS.AES.encrypt(npass,$.cookie("sid")).toString();
|
|
const sid = $.cookie("sid");
|
|
$.post( "/back_login", { login:login,pass:pass,sid:sid })
|
|
.done(function( res ) {
|
|
if (res["out"] == "bad"){
|
|
console.log(res["err"]);
|
|
if (res["err"] == "user" || res["err"] == "pass"){
|
|
document.querySelector("#res").innerHTML = "<p>wrong password or login</p>";
|
|
}
|
|
}
|
|
else{
|
|
if(res["out"] == "goto"){
|
|
// postForm(res["url"], res["args"]);
|
|
goto(res["url"]);
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
var input = document.getElementById("pass");
|
|
input.addEventListener("keypress", function(event) {
|
|
if (event.key === "Enter") {
|
|
event.preventDefault();
|
|
document.getElementById("log_btn").click();
|
|
}
|
|
});
|
|
</script>
|