Skip to content

Commit

Permalink
Convert high level config to low level config
Browse files Browse the repository at this point in the history
min_password_length is a low level config item that should rarely need to be customized since it is a common security standard
  • Loading branch information
Samuel Georges committed Sep 1, 2019
1 parent 0b6688e commit 243ab40
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 18 deletions.
2 changes: 0 additions & 2 deletions lang/de/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,6 @@
'notifications_tab' => 'Benachrichtigungen',
'allow_registration' => 'Benutzerregistrierung erlauben',
'allow_registration_comment' => 'Falls dies deaktivert ist, können Benutzer nur von Administratoren erstellt werden.',
'min_password_length' => 'Minimale Passwortlänge',
'min_password_length_comment' => 'Die minimale Passwortlänge für Benutzerpasswörter.',
'activate_mode' => 'Aktivierungsmodus',
'activate_mode_comment' => 'Wählen Sie aus, wie ein Benutzer aktiviert werden soll.',
'activate_mode_auto' => 'Automatisch',
Expand Down
2 changes: 0 additions & 2 deletions lang/en/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@
'notifications_tab' => 'Notifications',
'allow_registration' => 'Allow user registration',
'allow_registration_comment' => 'If this is disabled users can only be created by administrators.',
'min_password_length' => 'Minimum password length',
'min_password_length_comment' => 'The minimum length of characters required for user passwords.',
'activate_mode' => 'Activation mode',
'activate_mode_comment' => 'Select how a user account should be activated.',
'activate_mode_auto' => 'Automatic',
Expand Down
2 changes: 0 additions & 2 deletions lang/ru/lang.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@
'notifications_tab' => 'Оповещения',
'allow_registration' => 'Разрешить регистрацию',
'allow_registration_comment' => 'Если эта опция выключена, только администраторы смогут регистрировать пользователей.',
'min_password_length' => 'Минимальная длина пароля',
'min_password_length_comment' => 'Минимальное количество символов для пароля пользователя.',
'activate_mode' => 'Активация',
'activate_mode_comment' => 'Активация пользователя.',
'activate_mode_auto' => 'Автоматическая',
Expand Down
2 changes: 0 additions & 2 deletions models/Settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class Settings extends Model
const REMEMBER_ALWAYS = 'always';
const REMEMBER_NEVER = 'never';
const REMEMBER_ASK = 'ask';
const MIN_PASSWORD_LENGTH_DEFAULT = 8;

public function initSettingsData()
{
Expand All @@ -37,7 +36,6 @@ public function initSettingsData()
$this->login_attribute = self::LOGIN_EMAIL;
$this->update_requires_password = false;
$this->remember_login = self::REMEMBER_ALWAYS;
$this->min_password_length = self::MIN_PASSWORD_LENGTH_DEFAULT;
$this->use_register_throttle = true;
}

Expand Down
3 changes: 2 additions & 1 deletion models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Auth;
use Mail;
use Event;
use Config;
use Carbon\Carbon;
use October\Rain\Auth\Models\User as UserBase;
use RainLab\User\Models\Settings as UserSettings;
Expand Down Expand Up @@ -201,7 +202,7 @@ public function getLoginName()
*/
public static function getMinPasswordLength()
{
return (int) UserSettings::get('min_password_length', UserSettings::MIN_PASSWORD_LENGTH_DEFAULT);
return Config::get('min_password_length', 8);
}

//
Expand Down
9 changes: 0 additions & 9 deletions models/settings/fields.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@ tabs:
type: switch
tab: rainlab.user::lang.settings.registration_tab

# Minimum password length
min_password_length:
span: left
commentAbove: rainlab.user::lang.settings.min_password_length_comment
label: rainlab.user::lang.settings.min_password_length
type: number
tab: rainlab.user::lang.settings.registration_tab
min: 1

# Require Activation
require_activation:
span: left
Expand Down

0 comments on commit 243ab40

Please sign in to comment.