trilium/src/views/login.ejs

78 lines
2.6 KiB
Text
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
2018-12-23 17:57:40 +08:00
<head>
<meta charset="utf-8">
2018-12-31 02:02:42 +08:00
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title>Login</title>
2019-01-29 05:48:01 +08:00
<link rel="apple-touch-icon" sizes="180x180" href="/images/app-icons/ios/apple-touch-icon.png">
2018-12-23 17:57:40 +08:00
</head>
<body>
2018-12-23 18:06:11 +08:00
<div class="container">
2019-01-06 04:49:40 +08:00
<div class="col-xs-12 col-sm-10 col-md-6 col-lg-4 col-xl-4 mx-auto" style="padding-top: 25px;">
2018-12-23 18:06:11 +08:00
<h1>Trilium login</h1>
2018-12-23 18:06:11 +08:00
<% if (failedAuth) { %>
<div class="alert alert-warning">
Username and / or password are incorrect. Please try again.
</div>
<% } %>
2018-12-23 18:06:11 +08:00
<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>
2018-12-23 17:57:40 +08:00
</div>
2018-12-23 18:06:11 +08:00
<div class="form-group">
<div class="checkbox">
<label>
<input id="remember-me" name="remember_me" value="1" type="checkbox"> Remember me
</label>
</div>
2018-12-23 17:57:40 +08:00
</div>
2018-12-23 18:06:11 +08:00
<div class="form-group">
<button class="btn btn-success">Login</button>
2018-12-23 17:57:40 +08:00
</div>
2018-12-23 18:06:11 +08:00
</form>
</div>
2018-12-23 17:57:40 +08:00
</div>
2017-10-21 11:43:20 +08:00
2018-12-29 06:47:06 +08:00
<script>
// Required for correct loading of scripts in Electron
if (typeof module === 'object') {window.module = module; module = undefined;}
2018-12-29 16:13:52 +08:00
let device;
2018-12-29 06:47:06 +08:00
2018-12-29 16:13:52 +08:00
if (window.location.search === '?desktop') {
device = "desktop";
}
else if (window.location.search === '?mobile') {
2018-12-29 06:47:06 +08:00
device = "mobile";
}
2018-12-29 16:13:52 +08:00
else {
// mobile device detection based on https://stackoverflow.com/a/24600597/944162
device = /Mobi/.test(navigator.userAgent) ? "mobile" : "desktop";
}
2018-12-29 06:47:06 +08:00
2019-01-06 04:49:40 +08:00
console.log("Setting device cookie to:", device);
2018-12-29 06:47:06 +08:00
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>
2019-07-01 02:14:57 +08:00
<link href="libraries/bootstrap/css/bootstrap.min.css" rel="stylesheet">
</body>
</html>