Notes/src/views/login.ejs

103 lines
3.6 KiB
Plaintext
Raw Normal View History

<!DOCTYPE html>
<html lang="en">
2018-12-23 10:57:40 +01:00
<head>
<meta charset="utf-8">
2018-12-30 19:02:42 +01:00
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
2024-09-08 18:12:16 +03:00
<title><%= t("login.title") %></title>
<link rel="apple-touch-icon" sizes="180x180" href="<%= assetPath %>/images/app-icons/ios/apple-touch-icon.png">
2020-04-03 19:34:22 +02:00
<link rel="shortcut icon" href="favicon.ico">
2018-12-23 10:57:40 +01:00
</head>
<body>
2018-12-23 11:06:11 +01:00
<div class="container">
2019-01-05 21:49:40 +01:00
<div class="col-xs-12 col-sm-10 col-md-6 col-lg-4 col-xl-4 mx-auto" style="padding-top: 25px;">
2024-09-08 18:12:16 +03:00
<h1><%= t("login.heading") %></h1>
2018-12-23 11:06:11 +01:00
<% if (failedAuth) { %>
2024-09-07 11:47:29 -07:00
<% if( totpEnabled ) { %>
<div class="alert alert-warning">
Password or TOTP is incorrect. Please try again.
</div>
<% }else{ %>
<div class="alert alert-warning">
Password is incorrect. Please try again.
</div>
<% } %>
2018-12-23 11:06:11 +01:00
<% } %>
2024-09-07 11:47:29 -07:00
2018-12-23 11:06:11 +01:00
<form action="login" method="POST">
<div class="form-group">
2024-09-08 18:12:16 +03:00
<label for="password"><%= t("login.password") %></label>
2018-12-23 11:06:11 +01:00
<div class="controls">
<input id="password" name="password" placeholder="" class="form-control" type="password">
</div>
2018-12-23 10:57:40 +01:00
</div>
2024-09-07 10:21:41 -07:00
<% if( totpEnabled ) { %>
<div class="form-group">
<label for="otp-token">OTP Token</label>
<div class="controls">
<input id="token" name="token" placeholder="" class="form-control" type="text"
required />
</div>
</div>
<% } %>
2018-12-23 11:06:11 +01:00
<div class="form-group">
<div class="checkbox">
<label>
2024-09-08 18:12:16 +03:00
<input id="remember-me" name="rememberMe" value="1" type="checkbox"> <%= t("login.remember-me") %>
2018-12-23 11:06:11 +01:00
</label>
</div>
2018-12-23 10:57:40 +01:00
</div>
2018-12-23 11:06:11 +01:00
<div class="form-group">
2024-09-08 18:12:16 +03:00
<button class="btn btn-success"><%= t("login.button") %></button>
2018-12-23 10:57:40 +01:00
</div>
2018-12-23 11:06:11 +01:00
</form>
</div>
2018-12-23 10:57:40 +01:00
</div>
2017-10-20 23:43:20 -04:00
2018-12-28 23:47:06 +01:00
<script>
// Required for correct loading of scripts in Electron
if (typeof module === 'object') {window.module = module; module = undefined;}
2018-12-29 09:13:52 +01:00
let device;
2018-12-28 23:47:06 +01:00
2018-12-29 09:13:52 +01:00
if (window.location.search === '?desktop') {
device = "desktop";
}
else if (window.location.search === '?mobile') {
2018-12-28 23:47:06 +01:00
device = "mobile";
}
2018-12-29 09:13:52 +01:00
else {
device = isMobile() ? "mobile" : "desktop";
2018-12-29 09:13:52 +01:00
}
2018-12-28 23:47:06 +01:00
2019-01-05 21:49:40 +01:00
console.log("Setting device cookie to:", device);
2018-12-28 23:47:06 +01: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=/";
}
// https://stackoverflow.com/a/73731646/944162
function isMobile() {
const mQ = matchMedia?.('(pointer:coarse)');
if (mQ?.media === '(pointer:coarse)') return !!mQ.matches;
if ('orientation' in window) return true;
return /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(navigator.userAgent) ||
/\b(Android|Windows Phone|iPad|iPod)\b/i.test(navigator.userAgent);
}
2018-12-28 23:47:06 +01:00
</script>
2019-06-30 20:14:57 +02:00
2024-08-11 01:59:50 +02:00
<link href="<%= assetPath %>/node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="<%= assetPath %>/stylesheets/theme-light.css" rel="stylesheet" />
<link href="<%= assetPath %>/stylesheets/theme-next.css" rel="stylesheet" />
<link href="<%= assetPath %>/stylesheets/style.css" rel="stylesheet">
2019-06-30 20:14:57 +02:00
</body>
2021-12-29 23:37:12 +01:00
</html>