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