blob: 5b0f10a443ab48f923f9c36b3e66b06758d601b1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
<?php
set_include_path(__DIR__ . "/include" . PATH_SEPARATOR . get_include_path());
require_once __DIR__ . "/include/common.php";
require_once __DIR__ . "/include/sessions.php";
Config::sanity_check();
logout_user();
?>
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="lib/bootstrap/v3/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link id="theme_css" href="lib/bootstrap/v3/css/theme-dark.min.css" rel="stylesheet" media="screen">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="dist/app-libs.min.js"></script>
<title>The Epube</title>
<link type="text/css" rel="stylesheet" media="screen" href="dist/app.min.css" />
<link rel="shortcut icon" type="image/png" href="img/favicon.png" />
<link rel="manifest" href="manifest.json">
<meta name="mobile-web-app-capable" content="yes">
<script type="text/javascript">
function apply_night_mode(is_night) {
console.log("night mode changed to", is_night);
$("#theme_css").attr("href",
"lib/bootstrap/v3/css/" + (is_night ? "theme-dark.min.css" : "bootstrap-theme.min.css"));
}
if (window.matchMedia) {
const mql = window.matchMedia('(prefers-color-scheme: dark)');
mql.addEventListener("change", () => {
apply_night_mode(mql.matches);
});
apply_night_mode(mql.matches);
}
$(document).ready(function() {
/* global EpubeApp */
$("#login_form").on("submit", (e) => {
e.preventDefault();
$.ajax({
url: "backend.php",
type: "POST",
data: $("#login_form").serialize(),
dataType: "json",
success: (response) => {
if (response.result === "ok") {
window.location.href = "index.html";
} else {
$("#login_notice").text(response.error || "Login failed.").show();
}
},
error: () => {
$("#login_notice").text("Server error. Please try again.").show();
}
});
});
$(".oidc_login_btn").on("click", (e) => {
e.preventDefault();
window.location.href = "backend.php?op=perform-oidc-login";
});
if (typeof EpubeApp != "undefined") {
EpubeApp.setPage("PAGE_LOGIN");
$("body").addClass("is-epube-app");
}
});
</script>
</head>
<body class="epube-login">
<div class="navbar navbar-default navbar-static-top">
<div class="container">
<div class="navbar-header">
<span class="navbar-brand"><a href="?">The Epube</a></span>
</div>
</div>
</div>
<div class="container">
<div id="login_notice" class="alert alert-danger" style="display:none"></div>
<form id="login_form">
<input type="hidden" name="op" value="perform-login">
<div class="form-group">
<label>User</label>
<input class="form-control" required="true" name="user">
</div>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" name="password" required="true">
</div>
<button type="submit" class="btn btn-primary">Log in</button>
<?php if (Config::get(Config::OIDC_URL) != "") { ?>
<button type="button" class="oidc_login_btn btn btn-default">Log in with <?= Config::get(Config::OIDC_NAME) ?></button>
<?php } ?>
</form>
</div>
</body>
</html>
|