Files
fnx_web/res/template/account/login.html

69 lines
2.2 KiB
HTML
Raw Normal View History

{{define "login"}}
2017-11-10 12:39:55 +01:00
<!DOCTYPE html>
2018-06-23 21:17:53 +02:00
<html>
2017-11-10 12:39:55 +01:00
<head>
{{template "meta_tags" "Login"}}
2018-06-23 21:17:53 +02:00
<script type="text/javascript">var apiEndpoint = '{{.APIEndpoint}}';</script>
2017-11-10 12:39:55 +01:00
</head>
<body>
<div id='body' class="body">
2018-06-21 23:41:50 +02:00
{{template "menu" .}}
<h1>Log in to your PixelDrain account</h1>
2018-06-23 21:17:53 +02:00
<div id="submit_result"></div>
<form onSubmit="return submitForm();" class="highlight_dark border_top border_bottom">
2018-07-09 21:41:17 +02:00
<table class="form">
<tr class="form">
2019-02-07 23:09:54 +01:00
<td>Username / e-mail</td>
<td><input id="username" name="username" type="text" autocomplete="username" value="" class="form_input"/></td>
2017-11-10 12:39:55 +01:00
</tr>
2018-07-09 21:41:17 +02:00
<tr class="form">
2017-11-10 12:39:55 +01:00
<td>Password</td>
2019-02-07 23:09:54 +01:00
<td><input id="password" name="password" type="password" autocomplete="current-password" class="form_input"/></td>
2017-11-10 12:39:55 +01:00
</tr>
2018-07-09 21:41:17 +02:00
<tr class="form">
2018-06-23 21:17:53 +02:00
<td colspan=2 style="text-align: right;"><input type="submit" value="Login" class="button_highlight"/></td>
</tr>
2017-11-10 12:39:55 +01:00
</table>
</form>
<br/>
2018-06-23 21:17:53 +02:00
If you don't have a PixelDrain account yet, you can <a href="/register">register here</a>. No e-mail address is required.<br/>
{{template "footer"}}
2017-11-10 12:39:55 +01:00
</div>
2018-06-23 21:17:53 +02:00
<script type="text/javascript">
function submitForm(){
var req = new XMLHttpRequest();
req.onreadystatechange = function(){
if (this.readyState === 4) {
var response = JSON.parse(req.responseText);
var resultDiv = document.getElementById("submit_result");
if (response.success) {
resultDiv.className = "border_top border_bottom highlight_green";
resultDiv.innerHTML = 'Success! Proceeding to user portal...<br/>'
+'<a href="/user">Click here if you are not redirected automatically</a>';
window.location.href = "/user";
} else {
resultDiv.className = "border_top border_bottom highlight_red";
resultDiv.innerHTML = response.message;
}
console.log(response);
}
}
var data = new FormData();
data.append("username", document.getElementById("username").value);
data.append("password", document.getElementById("password").value);
req.open("POST", apiEndpoint+"/user/login", true);
req.send(data);
return false;
}
</script>
{{template "analytics"}}
2017-11-10 12:39:55 +01:00
</body>
</html>
{{end}}