xref: /webtrees/resources/views/edit-account-page.phtml (revision 1fe542e96f8f7eedeebc278fae1e0ab0d9e74d95)
1<?php
2
3use Fisharebest\Webtrees\Contracts\UserInterface;
4use Fisharebest\Webtrees\Http\RequestHandlers\AccountDelete;
5use Fisharebest\Webtrees\I18N;
6use Fisharebest\Webtrees\Tree;
7use Fisharebest\Webtrees\User;
8use Fisharebest\Webtrees\View;
9
10?>
11
12<h2 class="wt-page-title">
13    <?= $title ?>
14</h2>
15
16<form method="post" class="wt-page-options wt-page-options-my-account">
17    <?= csrf_field() ?>
18
19    <div class="row form-group">
20        <label class="col-sm-3 col-form-label wt-page-options-label" for="user-name">
21            <?= I18N::translate('Username') ?>
22        </label>
23        <div class="col-sm-9 wt-page-options-value">
24            <input type="text" class="form-control" id="user-name" name="user_name" value="<?= e($user->userName()) ?>" dir="auto" aria-describedby="username-description" required>
25            <p class="small text-muted" id="username-description">
26                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
27            </p>
28        </div>
29    </div>
30
31    <div class="row form-group">
32        <label class="col-sm-3 col-form-label wt-page-options-label" for="real-name">
33            <?= I18N::translate('Real name') ?>
34        </label>
35        <div class="col-sm-9 wt-page-options-value">
36            <input type="text" class="form-control" id="real-name" name="real_name" value="<?= e($user->realName()) ?>" dir="auto" aria-describedby="real-name-description" required>
37            <p class="small text-muted" id="real-name-description">
38                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
39            </p>
40        </div>
41    </div>
42
43    <?php if ($tree instanceof Tree) : ?>
44        <div class="row form-group">
45            <label class="col-sm-3 col-form-label wt-page-options-label" for="gedcom-id">
46                <?= I18N::translate('Individual record') ?>
47            </label>
48            <div class="col-sm-9 wt-page-options-value">
49                <select class="form-control" id="gedcom-id" aria-describedby="gedcom-id-description" disabled>
50                    <?php if ($my_individual_record !== null) : ?>
51                        <option value=""><?= $my_individual_record->fullName() ?></option>
52                    <?php else : ?>
53                        <option value=""><?= I18N::translateContext('unknown people', 'Unknown') ?></option>
54                    <?php endif ?>
55                </select>
56                <p class="small text-muted" id="gedcom-id-description">
57                    <?= I18N::translate('This is a link to your own record in the family tree. If this is the wrong individual, contact an administrator.') ?>
58                </p>
59            </div>
60        </div>
61
62        <div class="row form-group">
63            <label class="col-sm-3 col-form-label wt-page-options-label" for="default-xref">
64                <?= I18N::translate('Default individual') ?>
65            </label>
66            <div class="col-sm-9 wt-page-options-value">
67                <?= view('components/select-individual', ['name' => 'default-xref', 'id' => 'default-xref', 'individual' => $default_individual, 'tree' => $tree]) ?>
68                <p class="small text-muted" id="default-xref-description">
69                    <?= I18N::translate('This individual will be selected by default when viewing charts and reports.') ?>
70                </p>
71            </div>
72        </div>
73    <?php endif ?>
74
75    <div class="row form-group">
76        <label class="col-sm-3 col-form-label wt-page-options-label" for="password">
77            <?= I18N::translate('Password') ?>
78        </label>
79        <div class="col-sm-9 wt-page-options-value">
80            <input class="form-control" type="password" id="password" name="password" aria-describedby="password-description" autocomplete="new-password">
81            <p class="small text-muted" id="password-description">
82                <?= I18N::translate('Passwords must be at least 8 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
83                <br>
84                <?= I18N::translate('Leave the password blank if you want to keep the current password.') ?>
85            </p>
86        </div>
87    </div>
88
89    <div class="row form-group">
90        <label class="col-sm-3 col-form-label wt-page-options-label" for="language">
91            <?= I18N::translate('Language') ?>
92        </label>
93        <div class="col-sm-9 wt-page-options-value">
94            <?= view('components/select', ['name' => 'language', 'selected' => $user->getPreference(UserInterface::PREF_LANGUAGE), 'options' => $languages]) ?>
95        </div>
96    </div>
97
98    <div class="row form-group">
99        <label class="col-sm-3 col-form-label wt-page-options-label" for="timezone">
100            <?= I18N::translate('Time zone') ?>
101        </label>
102        <div class="col-sm-9 wt-page-options-value">
103            <?= view('components/select', ['name' => 'timezone', 'selected' => $user->getPreference(UserInterface::PREF_TIME_ZONE, 'UTC'), 'options' => $timezones]) ?>
104            <p class="small text-muted" id="timezone-description">
105                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
106            </p>
107        </div>
108    </div>
109
110    <div class="row form-group">
111        <label class="col-sm-3 col-form-label wt-page-options-label" for="email">
112            <?= I18N::translate('Email address') ?>
113        </label>
114        <div class="col-sm-9 wt-page-options-value">
115            <input class="form-control" type="email" id="email" name="email" value="<?= e($user->email()) ?>" aria-describedby="email-description">
116            <p class="small text-muted" id="email-description">
117                <?= 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.') ?>
118            </p>
119        </div>
120    </div>
121
122    <div class="row form-group">
123        <label class="col-sm-3 col-form-label wt-page-options-label" for="contact-method">
124            <?= I18N::translate('Contact method') ?>
125        </label>
126        <div class="col-sm-9 wt-page-options-value">
127            <?= view('components/select', ['name' => 'contact-method', 'id' => 'contact-method', 'selected' => $user->getPreference(UserInterface::PREF_CONTACT_METHOD), 'options' => $contact_methods]) ?>
128            <p class="small text-muted" id="contact-method-description">
129            <?= I18N::translate('Site members can send each other messages. You can choose to how these messages are sent to you, or choose not receive them at all.') ?>
130            </p>
131        </div>
132    </div>
133
134    <fieldset class="form-group">
135        <div class="row">
136            <legend class="col-sm-3 col-form-label wt-page-options-label">
137                <?= I18N::translate('Visible online') ?>
138            </legend>
139            <div class="col-sm-9 wt-page-options-value">
140                <?= view('components/checkbox', ['label' => I18N::translate('Visible to other users when online'), 'name' => 'visible-online', 'checked' => (bool) $user->getPreference(UserInterface::PREF_IS_VISIBLE_ONLINE)]) ?>
141                <p class="small text-muted" id="visible-online-description">
142                    <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
143                </p>
144            </div>
145        </div>
146    </fieldset>
147
148    <div class="row form-group">
149        <div class="col-sm-3 wt-page-options-label"></div>
150        <div class="col-sm-9 wt-page-options-value">
151            <button type="submit" class="btn btn-primary">
152                <?= view('icons/save') ?>
153                <?= I18N::translate('save') ?>
154            </button>
155        </div>
156    </div>
157</form>
158
159<?php if ($show_delete_option) : ?>
160    <div class="row form-group">
161        <div class="col-sm-3 wt-page-options-label"></div>
162        <div class="col-sm-9 wt-page-options-value">
163            <a href="#" class="btn btn-danger" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($user->userName())) ?>" data-post-url="<?= e(route(AccountDelete::class)) ?>">
164                <?= view('icons/delete') ?>
165                <?= I18N::translate('Delete your account') ?>
166            </a>
167        </div>
168    </div>
169<?php endif ?>
170
171<?php View::push('javascript') ?>
172<script>
173    $('#password').hideShowPassword('infer', true);
174</script>
175<?php View::endpush() ?>
176