xref: /webtrees/resources/views/admin/users-create.phtml (revision b11cdcd45131b1585d66693fab363cfeb18c51a4)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Http\RequestHandlers\ControlPanel;
6use Fisharebest\Webtrees\Http\RequestHandlers\UserAddAction;
7use Fisharebest\Webtrees\Http\RequestHandlers\UserListPage;
8use Fisharebest\Webtrees\I18N;
9use Fisharebest\Webtrees\View;
10
11/**
12 * @var string $email
13 * @var string $real_name
14 * @var string $title
15 * @var string $username
16 */
17
18?>
19
20<?= view('components/breadcrumbs', ['links' => [
21    route(ControlPanel::class) => I18N::translate('Control panel'),
22    route(UserListPage::class) => I18N::translate('User administration'),
23    $title,
24]]) ?>
25
26<h1><?= $title ?></h1>
27
28<form method="post" action="<?= e(route(UserAddAction::class)) ?>" class="form-horizontal" autocomplete="off">
29    <!-- REAL NAME -->
30    <div class="row mb-3">
31        <label class="col-sm-3 col-form-label" for="real_name">
32            <?= I18N::translate('Real name') ?>
33        </label>
34        <div class="col-sm-9">
35            <input class="form-control" type="text" id="real_name" name="real_name" required="required" maxlength="64" value="<?= e($real_name) ?>" dir="auto">
36            <div class="form-text">
37                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
38            </div>
39        </div>
40    </div>
41
42    <!-- USER NAME -->
43    <div class="row mb-3">
44        <label class="col-sm-3 col-form-label" for="username">
45            <?= I18N::translate('Username') ?>
46        </label>
47        <div class="col-sm-9">
48            <input class="form-control" type="text" id="username" name="username" required="required" maxlength="32" value="<?= e($username) ?>" dir="auto">
49            <div class="form-text">
50                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
51            </div>
52        </div>
53    </div>
54
55    <!-- PASSWORD -->
56    <div class="row mb-3">
57        <label class="col-sm-3 col-form-label" for="password">
58            <?= I18N::translate('Password') ?>
59        </label>
60        <div class="col-sm-9">
61            <input class="form-control" type="password" id="password" name="password" pattern = ".{8,}" placeholder="<?= I18N::plural('Use at least %s character.', 'Use at least %s characters.', 8, I18N::number(8)) ?>" required="required" autocomplete="new-password" data-wt-show-password-text="<?= e(I18N::translate('show')) ?>" data-wt-show-password-title="<?= e(I18N::translate('Show password')) ?>" data-wt-hide-password-text="<?= e(I18N::translate('hide')) ?>" data-wt-hide-password-title="<?= e(I18N::translate('Hide password')) ?>">
62            <div class="form-text">
63                <?= I18N::translate('Passwords must be at least 8 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
64            </div>
65        </div>
66    </div>
67
68    <!-- EMAIL ADDRESS -->
69    <div class="row mb-3">
70        <label class="col-sm-3 col-form-label" for="email">
71            <?= I18N::translate('Email address') ?>
72        </label>
73        <div class="col-sm-9">
74            <input class="form-control" type="email" id="email" name="email" required="required" maxlength="64" value="<?= e($email) ?>">
75            <div class="form-text">
76                <?= I18N::translate('This email address will be used to send password reminders, website notifications, and messages from other family members who are registered on the website.') ?>
77            </div>
78        </div>
79    </div>
80
81    <div class="row mb-3">
82        <div class="offset-sm-3 col-sm-9">
83            <button type="submit" class="btn btn-primary">
84                <?= I18N::translate('save') ?>
85            </button>
86        </div>
87    </div>
88
89    <?= csrf_field() ?>
90</form>
91
92<?php View::push('javascript') ?>
93<script>
94  function regex_quote(str) {
95    return str.replace(/[\\.?+*()[\]{}|]/g, "\\$&");
96  }
97</script>
98<?php View::endpush() ?>
99