xref: /webtrees/resources/views/edit-account-page.phtml (revision e5a6b4d4f6f6e7ff2fba7ae2cf27546ae68a79cc)
1<?php use Fisharebest\Webtrees\Bootstrap4; ?>
2<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?>
3<?php use Fisharebest\Webtrees\I18N; ?>
4
5<script>
6  function checkform(frm) {
7    if (frm.password.value !== frm.password2.value) {
8      alert("<?= I18N::translate('The passwords do not match.') ?>");
9      frm.password.focus();
10      return false;
11    }
12    if (frm.password.value.length > 0 && frm.password.value.length < 6) {
13      alert("<?= I18N::translate('Passwords must contain at least 6 characters.') ?>");
14      frm.password.focus();
15      return false;
16    }
17    return true;
18  }
19</script>
20
21<h2 class="wt-page-title">
22    <?= $title ?>
23</h2>
24
25<form class="wt-page-options wt-page-options-my-account" method="post" onsubmit="return checkform(this);">
26    <?= csrf_field() ?>
27    <input type="hidden" name="ged" value="<?= e($tree->name()) ?>">
28
29    <div class="row form-group">
30        <label class="col-sm-3 col-form-label wt-page-options-label" for="user-name">
31            <?= I18N::translate('Username') ?>
32        </label>
33        <div class="col-sm-9 wt-page-options-value">
34            <input type="text" class="form-control" id="user-name" name="user_name" value="<?= e($user->getUserName()) ?>" dir="auto" aria-describedby="username-description" required>
35            <p class="small text-muted" id="username-description">
36                <?= I18N::translate('Usernames are case-insensitive and ignore accented letters, so that “chloe”, “chloë”, and “Chloe” are considered to be the same.') ?>
37            </p>
38        </div>
39    </div>
40
41    <div class="row form-group">
42        <label class="col-sm-3 col-form-label wt-page-options-label" for="real-name">
43            <?= I18N::translate('Real name') ?>
44        </label>
45        <div class="col-sm-9 wt-page-options-value">
46            <input type="text" class="form-control" id="real-name" name="real_name" value="<?= e($user->realName()) ?>" dir="auto" aria-describedby="real-name-description" required>
47            <p class="small text-muted" id="username-description">
48                <?= I18N::translate('This is your real name, as you would like it displayed on screen.') ?>
49            </p>
50        </div>
51    </div>
52
53    <div class="row form-group">
54        <label class="col-sm-3 col-form-label wt-page-options-label" for="gedcom-id">
55            <?= I18N::translate('Individual record') ?>
56        </label>
57        <div class="col-sm-9 wt-page-options-value">
58            <select class="form-control" id="gedcom-id" aria-describedby="gedcom-id-description" disabled>
59                <?php if ($my_individual_record !== null) : ?>
60                    <option value=""><?= $my_individual_record->getFullName() ?></option>
61                <?php else : ?>
62                    <option value=""><?= I18N::translateContext('unknown people', 'Unknown') ?></option>
63                <?php endif ?>
64            </select>
65            <p class="small text-muted" id="gedcom-id-description">
66                <?= I18N::translate('This is a link to your own record in the family tree. If this is the wrong individual, contact an administrator.') ?>
67            </p>
68        </div>
69    </div>
70
71    <div class="row form-group">
72        <label class="col-sm-3 col-form-label wt-page-options-label" for="root-id">
73            <?= I18N::translate('Default individual') ?>
74        </label>
75        <div class="col-sm-9 wt-page-options-value">
76            <?= FunctionsEdit::formControlIndividual($tree, $default_individual, ['id' => 'root-id',
77            'name' => 'root_id', 'aria-describedby' => 'root-id-description']) ?>
78            <p class="small text-muted" id="root-id-description">
79                <?= I18N::translate('This individual will be selected by default when viewing charts and reports.') ?>
80            </p>
81        </div>
82    </div>
83
84    <div class="row form-group">
85        <label class="col-sm-3 col-form-label wt-page-options-label" for="password">
86            <?= I18N::translate('Password') ?>
87        </label>
88        <div class="col-sm-9 wt-page-options-value">
89            <input class="form-control" type="password" id="password" name="password" aria-describedby="password-description" autocomplete="new-password">
90            <p class="small text-muted" id="password-description">
91                <?= I18N::translate('Passwords must be at least 6 characters long and are case-sensitive, so that “secret” is different from “SECRET”.') ?>
92                <br>
93                <?= I18N::translate('Leave the password blank if you want to keep the current password.') ?>
94            </p>
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="password2">
100            <?= I18N::translate('Confirm password') ?>
101        </label>
102        <div class="col-sm-9 wt-page-options-value">
103            <input class="form-control" type="password" id="password2" name="password2" aria-describedby="password2-description" autocomplete="new-password">
104            <p class="small text-muted" id="password2-description">
105                <?= I18N::translate('Type your password again, to make sure you have typed it correctly.') ?>
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="language">
112            <?= I18N::translate('Language') ?>
113        </label>
114        <div class="col-sm-9 wt-page-options-value">
115            <?= Bootstrap4::select($installed_languages, $user->getPreference('language'), ['id' => 'language', 'name' => 'language']) ?>
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="timezone">
121            <?= I18N::translate('Time zone') ?>
122        </label>
123        <div class="col-sm-9 wt-page-options-value">
124            <?= Bootstrap4::select($timezones, $user->getPreference('TIMEZONE', 'UTC'), ['id' => 'timezone', 'name' => 'timezone', 'aria-describedby' => 'timezone-description']) ?>
125            <p class="small text-muted" id="timezone-description">
126                <?= I18N::translate('The time zone is required for date calculations, such as knowing today’s date.') ?>
127            </p>
128        </div>
129    </div>
130
131    <div class="row form-group">
132        <label class="col-sm-3 col-form-label wt-page-options-label" for="email">
133            <?= I18N::translate('Email address') ?>
134        </label>
135        <div class="col-sm-9 wt-page-options-value">
136            <input class="form-control" type="email" id="email" name="email" value="<?= e($user->email()) ?>" aria-describedby="email-description">
137            <p class="small text-muted" id="email-description">
138                <?= 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.') ?>
139            </p>
140        </div>
141    </div>
142
143    <?php if (count($themes) > 2) : ?>
144        <div class="row form-group">
145            <label class="col-sm-3 col-form-label wt-page-options-label" for="theme">
146                <?= I18N::translate('Theme') ?>
147            </label>
148            <div class="col-sm-9 wt-page-options-value">
149                <?= Bootstrap4::select($themes, $user->getPreference('theme'), ['id' => 'theme', 'name' => 'theme', 'aria-describedby' => 'theme-description']) ?>
150                <p class="small text-muted" id="theme-description">
151                    <?= /* I18N: Help text for the "Default theme" site configuration setting */
152                    I18N::translate('You can change the appearance of webtrees using “themes”. Each theme has a different style, layout, color scheme, etc.') ?>
153                </p>
154            </div>
155        </div>
156    <?php endif ?>
157
158    <div class="row form-group">
159        <label class="col-sm-3 col-form-label wt-page-options-label" for="contact-method">
160            <?= I18N::translate('Contact method') ?>
161        </label>
162        <div class="col-sm-9 wt-page-options-value">
163            <?= Bootstrap4::select($contact_methods, $user->getPreference('contactmethod'), ['id' => 'contact-method', 'name' => 'contact_method', 'aria-describedby' => 'contact-method-description']) ?>
164            <p class="small text-muted" id="contact-method-description">
165            <?= 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.') ?>
166            </p>
167        </div>
168    </div>
169
170    <fieldset class="form-group">
171        <div class="row">
172            <legend class="col-sm-3 col-form-label wt-page-options-label">
173                <?= I18N::translate('Visible online') ?>
174            </legend>
175            <div class="col-sm-9 wt-page-options-value">
176                <?= Bootstrap4::checkbox(I18N::translate('Visible to other users when online'), false, ['name' => 'visible_online', 'checked' => (bool) $user->getPreference('visibleonline'), 'aria-describedby' => 'visible-online-description']) ?>
177                <p class="small text-muted" id="visible-online-description">
178                    <?= I18N::translate('You can choose whether to appear in the list of users who are currently signed-in.') ?>
179                </p>
180            </div>
181        </div>
182    </fieldset>
183
184    <div class="row form-group">
185        <div class="col-sm-3 wt-page-options-label"></div>
186        <div class="col-sm-9 wt-page-options-value">
187            <input class="btn btn-primary" type="submit" value="<?= I18N::translate('save') ?>">
188        </div>
189    </div>
190</form>
191
192<?php if ($show_delete_option) : ?>
193    <form action="<?= e(route('delete-account', ['ged' => $tree->name()])) ?>" method="post">
194        <?= csrf_field() ?>
195        <div class="row form-group">
196            <div class="col-sm-3 wt-page-options-label"></div>
197            <div class="col-sm-9 wt-page-options-value">
198                <input class="btn btn-danger" type="submit" value="<?= I18N::translate('Delete your account') ?>" data-confirm="<?= I18N::translate('Are you sure you want to delete “%s”?', e($user->getUserName())) ?>" onclick="return confirm(this.dataset.confirm);">
199            </div>
200        </div>
201    </form>
202<?php endif ?>
203