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:
<?php
class SecurityConfig extends AbstractConfigData
{
const INTERNAL_PASSWORD_MIN_LENGTH = 'internal_password_min_length';
const INTERNAL_PASSWORD_STRENGTH = 'internal_password_strength';
const LOGIN_AND_EMAIL_FORBIDDEN_IN_PASSWORD = 'login_and_email_forbidden_in_password';
const PASSWORD_STRENGTH_WEAK = 'weak';
const PASSWORD_STRENGTH_MEDIUM = 'medium';
const PASSWORD_STRENGTH_STRONG = 'strong';
const PASSWORD_STRENGTH_VERY_STRONG = 'very_strong';
public function get_internal_password_min_length()
{
return $this->get_property(self::INTERNAL_PASSWORD_MIN_LENGTH);
}
public function set_internal_password_min_length($value)
{
$this->set_property(self::INTERNAL_PASSWORD_MIN_LENGTH, $value);
}
public function get_internal_password_strength()
{
return $this->get_property(self::INTERNAL_PASSWORD_STRENGTH);
}
public function set_internal_password_strength($value)
{
$this->set_property(self::INTERNAL_PASSWORD_STRENGTH, $value);
}
public function forbid_login_and_email_in_password()
{
$this->set_property(self::LOGIN_AND_EMAIL_FORBIDDEN_IN_PASSWORD, true);
}
public function allow_login_and_email_in_password()
{
$this->set_property(self::LOGIN_AND_EMAIL_FORBIDDEN_IN_PASSWORD, false);
}
public function are_login_and_email_forbidden_in_password()
{
return $this->get_property(self::LOGIN_AND_EMAIL_FORBIDDEN_IN_PASSWORD);
}
public function get_default_values()
{
return array(
self::INTERNAL_PASSWORD_MIN_LENGTH => 6,
self::INTERNAL_PASSWORD_STRENGTH => self::PASSWORD_STRENGTH_WEAK,
self::LOGIN_AND_EMAIL_FORBIDDEN_IN_PASSWORD => false
);
}
public static function load()
{
return ConfigManager::load(__CLASS__, 'kernel', 'security');
}
public static function save()
{
ConfigManager::save('kernel', self::load(), 'security');
}
}
?>