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