Sets maximum to 64 for username_min/max_length config keys
This commit is contained in:
parent
c1bca43fee
commit
4ec56a0975
|
@ -367,13 +367,13 @@ urlpath =
|
||||||
; username_min_length (Integer)
|
; username_min_length (Integer)
|
||||||
; The minimum character length a username can be.
|
; The minimum character length a username can be.
|
||||||
; This length is check once the username has been trimmed and multiple spaces have been collapsed into one.
|
; This length is check once the username has been trimmed and multiple spaces have been collapsed into one.
|
||||||
; Minimum for this config value is 1. Maximum is 150 as the resulting profile URL shouldn't be longer than 255 chars.
|
; Minimum for this config value is 1. Maximum is 64 as the resulting profile URL mustn't be longer than 255 chars.
|
||||||
username_min_length = 3
|
username_min_length = 3
|
||||||
|
|
||||||
; username_max_length (Integer)
|
; username_max_length (Integer)
|
||||||
; The maximum character length a username can be.
|
; The maximum character length a username can be.
|
||||||
; This length is check once the username has been trimmed and multiple spaces have been collapsed into one.
|
; This length is check once the username has been trimmed and multiple spaces have been collapsed into one.
|
||||||
; Minimum for this config value is 1. Maximum is 150 as the resulting profile URL shouldn't be longer than 255 chars.
|
; Minimum for this config value is 1. Maximum is 64 as the resulting profile URL mustn't be longer than 255 chars.
|
||||||
username_max_length = 48
|
username_max_length = 48
|
||||||
|
|
||||||
; worker_cooldown (Integer)
|
; worker_cooldown (Integer)
|
||||||
|
|
|
@ -466,8 +466,8 @@ class User
|
||||||
// collapse multiple spaces in name
|
// collapse multiple spaces in name
|
||||||
$username = preg_replace('/ +/', ' ', $username);
|
$username = preg_replace('/ +/', ' ', $username);
|
||||||
|
|
||||||
$username_min_length = max(1, min(150, intval(Config::get('system', 'username_min_length', 3))));
|
$username_min_length = max(1, min(64, intval(Config::get('system', 'username_min_length', 3))));
|
||||||
$username_max_length = max(1, min(150, intval(Config::get('system', 'username_max_length', 48))));
|
$username_max_length = max(1, min(64, intval(Config::get('system', 'username_max_length', 48))));
|
||||||
|
|
||||||
if ($username_min_length > $username_max_length) {
|
if ($username_min_length > $username_max_length) {
|
||||||
logger(L10n::t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), LOGGER_WARNING);
|
logger(L10n::t('system.username_min_length (%s) and system.username_max_length (%s) are excluding each other, swapping values.', $username_min_length, $username_max_length), LOGGER_WARNING);
|
||||||
|
|
Loading…
Reference in a new issue