Skip to content

Commit 49dfee2

Browse files
committed
Move update_requires_password setting to component setting
This setting controls the business logic of a component and should be a component setting
1 parent 243ab40 commit 49dfee2

File tree

4 files changed

+10
-13
lines changed

4 files changed

+10
-13
lines changed

components/Account.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,12 @@ public function defineProperties()
5555
'type' => 'checkbox',
5656
'default' => 0
5757
],
58+
'requirePassword' => [
59+
'title' => /*Confirm password on update*/'rainlab.user::lang.account.update_requires_password',
60+
'description' => /*Require the current password of the user when changing their profile.*/'rainlab.user::lang.account.update_requires_password_comment',
61+
'type' => 'checkbox',
62+
'default' => 0
63+
],
5864
];
5965
}
6066

@@ -146,7 +152,7 @@ public function loginAttributeLabel()
146152
*/
147153
public function updateRequiresPassword()
148154
{
149-
return UserSettings::get('update_requires_password', false);
155+
return $this->property('requirePassword', false);
150156
}
151157

152158
/**

lang/en/lang.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@
9898
'remember_always' => 'Always',
9999
'remember_never' => 'Never',
100100
'remember_ask' => 'Ask the user on login',
101-
'update_requires_password' => 'Confirm current password on update',
102-
'update_requires_password_comment' => 'Require the current password of the user when changing their profile.'
103101
],
104102
'user' => [
105103
'label' => 'User',
@@ -193,7 +191,9 @@
193191
'password' => 'Password',
194192
'login' => 'Login',
195193
'new_password' => 'New Password',
196-
'new_password_confirm' => 'Confirm New Password'
194+
'new_password_confirm' => 'Confirm New Password',
195+
'update_requires_password' => 'Confirm password on update',
196+
'update_requires_password_comment' => 'Require the current password of the user when changing their profile.'
197197
],
198198
'reset_password' => [
199199
'reset_password' => 'Reset Password',

models/Settings.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ public function initSettingsData()
3434
$this->block_persistence = false;
3535
$this->allow_registration = true;
3636
$this->login_attribute = self::LOGIN_EMAIL;
37-
$this->update_requires_password = false;
3837
$this->remember_login = self::REMEMBER_ALWAYS;
3938
$this->use_register_throttle = true;
4039
}

models/settings/fields.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,3 @@ tabs:
6767
label: rainlab.user::lang.settings.activate_mode
6868
type: radio
6969
tab: rainlab.user::lang.settings.activation_tab
70-
71-
# Require current password when editing profile
72-
update_requires_password:
73-
span: left
74-
label: rainlab.user::lang.settings.update_requires_password
75-
commentAbove: rainlab.user::lang.settings.update_requires_password_comment
76-
type: switch
77-
tab: rainlab.user::lang.settings.profile_tab

0 commit comments

Comments
 (0)