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