xref: /webtrees/resources/views/login-page.phtml (revision 86661454ca7b7e2d48e9e107905c03de74517d0c)
1<?php
2
3use Fisharebest\Webtrees\Http\RequestHandlers\LoginAction;
4use Fisharebest\Webtrees\Http\RequestHandlers\PasswordRequestPage;
5use Fisharebest\Webtrees\Http\RequestHandlers\RegisterPage;
6use Fisharebest\Webtrees\I18N;
7use Fisharebest\Webtrees\Tree;
8use Fisharebest\Webtrees\View;
9
10/**
11 * @var string $error
12 * @var string $warning
13 * @var string $welcome
14 * @var string $url
15 * @var string $username
16 * @var bool   $can_register
17 */
18?>
19
20<?php if ($error) : ?>
21    <div class="alert alert-danger">
22        <?= $error ?>
23    </div>
24<?php endif ?>
25
26<h2 class="wt-page-title">
27    <?= I18N::translate('Welcome to this genealogy website') ?>
28</h2>
29
30<p>
31    <?= nl2br($welcome, false) ?>
32</p>
33
34<form method="post" action="<?= e(route(LoginAction::class, ['tree' => $tree instanceof Tree ? $tree->name() : null])) ?>" class="wt-page-options wt-page-options-login">
35    <?= csrf_field() ?>
36    <input type="hidden" name="url" value="<?= e($url) ?>">
37
38    <div class="form-group row">
39        <label class="col-sm-3 col-form-label wt-page-options-label" for="username">
40            <?= I18N::translate('Username') ?>
41        </label>
42        <div class="col-sm-9 wt-page-options-value">
43            <input class="form-control" type="text" id="username" name="username" required value="<?= e($username) ?>" autocomplete="username">
44        </div>
45    </div>
46
47    <div class="form-group row">
48        <label class="col-sm-3 col-form-label wt-page-options-label" for="password">
49            <?= I18N::translate('Password') ?>
50        </label>
51        <div class="col-sm-9 wt-page-options-value">
52            <input autocomplete="current-password" class="form-control" id="password" name="password" required type="password">
53        </div>
54    </div>
55
56    <div class="form-group row">
57        <div class="col-sm-3 col-form-label wt-page-options-label">
58        </div>
59        <div class="col-sm-9 wt-page-options-value">
60            <button class="btn btn-primary" type="submit">
61                <?= /* I18N: A button label. */
62                I18N::translate('sign in') ?>
63            </button>
64
65            <a class="btn btn-link" href="<?= e(route(PasswordRequestPage::class)) ?>">
66                <?= I18N::translate('Forgot password?') ?>
67            </a>
68
69            <?php if ($can_register) : ?>
70                <a class="btn btn-link" href="<?= e(route(RegisterPage::class)) ?>">
71                    <?= I18N::translate('Request a new user account') ?>
72                </a>
73            <?php endif ?>
74        </div>
75    </div>
76</form>
77
78<?php View::push('javascript') ?>
79<script>
80    $("#password").hideShowPassword("infer", true);
81</script>
82<?php View::endpush() ?>
83