login.php 2.36 KB
Newer Older
1
2
3
4
5
6
7
<?php
set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');

include_once("aur.inc.php");
set_lang();
check_sid();

8
9
$disable_http_login = config_get_bool('options', 'disable_http_login');
if (!$disable_http_login || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) {
10
11
12
13
14
15
16
	$login = try_login();
	$login_error = $login['error'];
}

html_header('AUR ' . __("Login"));
?>
<div id="dev-login" class="box">
Lukas Fleischer's avatar
Lukas Fleischer committed
17
	<h2>AUR <?= __('Login') ?></h2>
18
19
	<?php if (isset($_COOKIE["AURSID"])): ?>
	<p>
Lukas Fleischer's avatar
Lukas Fleischer committed
20
		<?= __("Logged-in as: %s", '<strong>' . username_from_sid($_COOKIE["AURSID"]) . '</strong>'); ?>
21
		<a href="<?= get_uri('/logout/'); ?>">[<?= __("Logout"); ?>]</a>
22
	</p>
23
	<?php elseif (!$disable_http_login || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])): ?>
24
	<form method="post" action="<?= get_uri('/login') ?>">
25
		<fieldset>
Lukas Fleischer's avatar
Lukas Fleischer committed
26
			<legend><?= __('Enter login credentials') ?></legend>
27
			<?php if (!empty($login_error)): ?>
Lukas Fleischer's avatar
Lukas Fleischer committed
28
			<ul class="errorlist"><li><?= $login_error ?></li></ul>
29
30
			<?php endif; ?>
			<p>
Lukas Fleischer's avatar
Lukas Fleischer committed
31
				<label for="id_username"><?= __('Username') . ':'; ?></label>
32
				<input id="id_username" type="text" name="user" size="30" maxlength="<?= config_get_int('options', 'username_max_len'); ?>" value="<?php if (isset($_POST['user'])) { print htmlspecialchars($_POST['user'], ENT_QUOTES); } ?>" autofocus="autofocus" />
33
34
			</p>
			<p>
Lukas Fleischer's avatar
Lukas Fleischer committed
35
				<label for="id_password"><?= __('Password') . ':'; ?></label>
36
				<input id="id_password" type="password" name="passwd" size="30" />
37
38
39
			</p>
			<p>
				<input type="checkbox" name="remember_me" id="id_remember_me" />
Lukas Fleischer's avatar
Lukas Fleischer committed
40
				<label for="id_remember_me"><?= __("Remember me"); ?></label>
41
42
43
			</p>
			<p>
				<input type="submit" class="button" value="<?php  print __("Login"); ?>" />
Lukas Fleischer's avatar
Lukas Fleischer committed
44
				<a href="<?= get_uri('/passreset/') ?>">[<?= __('Forgot Password') ?>]</a>
45
46
47
48
49
				<?php if (in_request('referer') !== ""): ?>
				<input id="id_referer" type="hidden" name="referer" value="<?= in_request('referer') ?>" />
				<?php elseif (isset($_SERVER['HTTP_REFERER'])): ?>
				<input id="id_referer" type="hidden" name="referer" value="<?= htmlspecialchars($_SERVER['HTTP_REFERER'], ENT_QUOTES) ?>" />
				<?php endif; ?>
50
51
52
53
54
55
			</p>
		</fieldset>
	</form>
	<?php else: ?>
	<p>
		<?php printf(__("HTTP login is disabled. Please %sswitch to HTTPs%s if you want to login."),
56
			'<a href="' . get_uri('/login', true) . '">', '</a>'); ?>
57
58
59
60
	</p>
	<?php endif; ?>
</div>
<?php
61
html_footer(AURWEB_VERSION);