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