Update wiki links to the new short URL
[aur.git] / web / html / login.php
blob3f3d66cc3fc8c8dd1438b1091cb28579c262a787
1 <?php
2 set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
4 include_once("aur.inc.php");
6 $disable_http_login = config_get_bool('options', 'disable_http_login');
7 if (!$disable_http_login || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])) {
8 $login = try_login();
9 $login_error = $login['error'];
12 $referer = in_request('referer');
13 if ($referer === '')
14 $referer = $_SERVER['HTTP_REFERER'];
16 html_header('AUR ' . __("Login"));
18 <div id="dev-login" class="box">
19 <h2>AUR <?= __('Login') ?></h2>
20 <?php if (isset($_COOKIE["AURSID"])): ?>
21 <p>
22 <?= __("Logged-in as: %s", '<strong>' . username_from_sid($_COOKIE["AURSID"]) . '</strong>'); ?>
23 <a href="<?= get_uri('/logout/'); ?>">[<?= __("Logout"); ?>]</a>
24 </p>
25 <?php elseif (!$disable_http_login || (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'])): ?>
26 <form method="post" action="<?= get_uri('/login') ?>">
27 <fieldset>
28 <legend><?= __('Enter login credentials') ?></legend>
29 <?php if (!empty($login_error)): ?>
30 <ul class="errorlist"><li><?= $login_error ?></li></ul>
31 <?php endif; ?>
32 <p>
33 <label for="id_username"><?= __('User name or primary email address') . ':'; ?></label>
34 <input id="id_username" type="text" name="user" size="30" maxlength="<?= max(config_get_int('options', 'username_max_len'), 254); ?>" value="<?php if (isset($_POST['user'])) { print htmlspecialchars($_POST['user'], ENT_QUOTES); } ?>" autofocus="autofocus" />
35 </p>
36 <p>
37 <label for="id_password"><?= __('Password') . ':'; ?></label>
38 <input id="id_password" type="password" name="passwd" size="30" />
39 </p>
40 <p>
41 <input type="checkbox" name="remember_me" id="id_remember_me" />
42 <label for="id_remember_me"><?= __("Remember me"); ?></label>
43 </p>
44 <p>
45 <input type="submit" class="button" value="<?php print __("Login"); ?>" />
46 <a href="<?= get_uri('/passreset/') ?>">[<?= __('Forgot Password') ?>]</a>
47 <?php if (config_get('sso', 'openid_configuration')):
48 $sso_login_url = get_uri('/sso/login');
49 if (isset($referer))
50 $sso_login_url .= '?redirect=' . urlencode($referer);
52 <a href="<?= htmlspecialchars($sso_login_url, ENT_QUOTES) ?>">[<?= __('Login through SSO') ?>]</a>
53 <?php endif; ?>
54 <?php if (isset($referer)): ?>
55 <input id="id_referer" type="hidden" name="referer" value="<?= htmlspecialchars($referer, ENT_QUOTES) ?>" />
56 <?php endif; ?>
57 </p>
58 </fieldset>
59 </form>
60 <?php else: ?>
61 <p>
62 <?php printf(__("HTTP login is disabled. Please %sswitch to HTTPs%s if you want to login."),
63 '<a href="' . get_uri('/login', true) . '">', '</a>'); ?>
64 </p>
65 <?php endif; ?>
66 </div>
67 <?php
68 html_footer(AURWEB_VERSION);