trilium/src/views/login.ejs
2018-12-29 09:13:52 +01:00

74 lines
2.3 KiB
Plaintext

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Login</title>
</head>
<body>
<div class="container">
<div class="col-md-5 offset-md-3">
<h1>Trilium login</h1>
<% if (failedAuth) { %>
<div class="alert alert-warning">
Username and / or password are incorrect. Please try again.
</div>
<% } %>
<form action="login" method="POST">
<div class="form-group">
<label for="username">Username</label>
<div class="controls">
<input id="username" name="username" placeholder="" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label for="password">Password</label>
<div class="controls">
<input id="password" name="password" placeholder="" class="form-control" type="password">
</div>
</div>
<div class="form-group">
<div class="checkbox">
<label>
<input id="remember-me" name="remember_me" value="1" type="checkbox"> Remember me
</label>
</div>
</div>
<div class="form-group">
<button class="btn btn-success">Login</button>
</div>
</form>
</div>
</div>
<script>
// Required for correct loading of scripts in Electron
if (typeof module === 'object') {window.module = module; module = undefined;}
let device;
if (window.location.search === '?desktop') {
device = "desktop";
}
else if (window.location.search === '?mobile') {
device = "mobile";
}
else {
// mobile device detection based on https://stackoverflow.com/a/24600597/944162
device = /Mobi/.test(navigator.userAgent) ? "mobile" : "desktop";
}
setCookie("trilium-device", device);
function setCookie(name, value) {
const date = new Date(Date.now() + 10 * 365 * 24 * 60 * 60 * 1000);
const expires = "; expires=" + date.toUTCString();
document.cookie = name + "=" + (value || "") + expires + "; path=/";
}
</script>
<link href="libraries/bootstrap/css/bootstrap.min.css" rel="stylesheet">
</body>
</html>