This repository was archived by the owner on Jun 4, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPasswordResetConfig.php
More file actions
95 lines (88 loc) · 2.45 KB
/
PasswordResetConfig.php
File metadata and controls
95 lines (88 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
class PasswordResetConfig extends ModuleConfig
{
function __construct() {
$userFields = wire('templates')->get('user')->fields;
$userFieldsArray = [];
$userFieldsArray['name'] = 'name';
foreach ($userFields as $field) {
if (!in_array($field->name, ['pass', 'roles', 'language'])) {
$userFieldsArray[$field->id] = $field->name;
}
}
$this->add(array(
array(
'name' => 'fieldname',
'label' => __('Validation field'),
'required' => true,
'type' => 'Select',
'options' => $userFieldsArray,
'description' => __('The field to match user registration against.')
))
);
if (class_exists("LanguageSupport", false)) {
foreach($this->languages as $language) {
$this->add(array(
array(
'name' => 'instructions' . $language->id,
'label' => __('Instructions') . " ({$language->name})",
'description' => __('Optional text displayed under the reset form validation field.'),
'type' => 'CKEditor'
)
));
}
} else {
$this->add(array(
array(
'name' => 'instructions',
'label' => __('Instructions'),
'type' => 'CKEditor',
'description' => __('Optional text displayed under the reset form validation field.')
)
));
}
$this->add(array(
array(
'name' => 'emailAddress',
'label' => __('Email address to send reset link from'),
'required' => true,
'type' => 'Text',
'value' => 'passwords-service@example.com'
),
array(
'name' => 'emailName',
'label' => __('Name to use for the email address'),
'type' => 'Text',
'value' => 'Passwords service'
),
array(
'name' => 'passwordLength',
'label' => __('Required password length'),
'required' => true,
'type' => 'Integer',
'value' => 8
)
));
if (class_exists("LanguageSupport", false)) {
foreach($this->languages as $language) {
$this->add(array(
array(
'name' => 'passwordInstructions' . $language->id,
'label' => __('Password instructions') . " ({$language->name})",
'description' => __('Optional (but strongly recommended) instructions displayed under the password input field.'),
'type' => 'CKEditor'
)
));
}
} else {
$this->add(array(
array(
'name' => 'passwordInstructions',
'label' => __('Password instructions'),
'description' => __('Optional (but strongly recommended) instructions displayed under the password input field.'),
'type' => 'CKEditor'
)
));
}
}
}