Elgg  Version 6.1
password.php
Go to the documentation of this file.
1 <?php
9 if (!$user instanceof \ElggUser) {
10  return;
11 }
12 
13 // only make the admin user enter current password for changing his own password.
14 $fields = [];
16  $fields[] = [
17  '#type' => 'password',
18  '#label' => elgg_echo('user:current_password:label'),
19  'name' => 'current_password',
20  'autocomplete' => 'current-password',
21  ];
22 }
23 
24 $fields[] = [
25  '#type' => 'password',
26  '#label' => elgg_echo('user:password:label'),
27  'name' => 'password',
28  'autocomplete' => 'new-password',
29  'add_security_requirements' => true,
30 ];
31 
32 $fields[] = [
33  '#type' => 'password',
34  '#label' => elgg_echo('user:password2:label'),
35  'name' => 'password2',
36  'autocomplete' => 'new-password',
37  'add_security_requirements' => true,
38 ];
39 
40 echo elgg_view_field([
41  '#type' => 'fieldset',
42  'legend' => elgg_echo('user:set:password'),
43  'fields' => $fields,
44 ]);
elgg_view_field(array $params=[])
Renders a form field, usually with a wrapper element, a label, help text, etc.
Definition: views.php:1112
elgg_is_admin_logged_in()
Returns whether or not the viewer is currently logged in and an admin user.
Definition: sessions.php:52
elgg_echo(string $message_key, array $args=[], string $language= '')
Elgg language module Functions to manage language and translations.
Definition: languages.php:17
$user
Provide a way of setting your password.
Definition: password.php:8
$vars['class']
Elgg password input Displays a password input field.
Definition: password.php:13
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:256
if(!$user instanceof\ElggUser) $fields
Definition: password.php:14
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:23
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:34