summaryrefslogtreecommitdiff
path: root/pages/login.ecpp
blob: 754ec82af0f118933047c6f60516d24f200b97eb (plain)
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
<%pre>
#include "tools.h"
#include "setup.h"

using namespace std;
using namespace vdrlive;

</%pre>
<%args>
std::string login;
std::string password;
std::string action;
</%args>
<%session scope="global">
bool logged_in(false);
</%session>
<{

std::string message;

if (action == "login") {
	if ((login == LiveSetup().GetAdminLogin()) && (MD5Hash(password) == LiveSetup().GetMD5HashAdminPassword())) {
		logged_in = true;
	} else {
		message = tr("Wrong username or password");
	}
} else if (action == "logout") {
	logged_in = false;
}

LiveSetup().CheckLocalNet(request.getPeerIp());

if (logged_in || !LiveSetup().UseAuth()) return reply.redirect(LiveSetup().GetStartScreenLink());

}>
<& pageelems.doc_type &>
<html>
	<head>
		<title>VDR-Live - <$ tr("Login") $></title>
		<& pageelems.stylesheets &>
		<& pageelems.ajax_js &>
	</head>
	<body onload="document.auth.login.focus()">
	<div style="width: 350px; margin: 0 auto; text-align: center; padding: 20px">
		<div class="boxheader"><div><div><$ tr("VDR Live Login") $></div></div></div>
		<div style="border: 1px solid black; padding: 15px">
			<img src="<$ LiveSetup().GetThemedLink("img", "logo_login.png") $>" alt="VDR Live"></img>
			<form name="auth">
				<input type="hidden" name="action" value="login" />
				<table class="login">
					<tr>
						<td><$ tr("User") $>:</td>
						<td><input type="text" name="login" value="<$ login $>" size="15" maxlength="15" /></td>
						<td>&nbsp;</td>
					</tr>
					<tr>
						<td><$ tr("Password") $>:</td>
						<td><input type="password" name="password" value="<$ password $>" size="15" maxlength="15" /></td>
						<td><button type="submit" class="blue"><$ tr("Login") $></td>
					</tr>
				</table>
			</form>
			<div style="color: red; margin: 0 auto;">
				<$ message $>
			</div>
		</div>
	</div>
	</body>
</html>