Possibility to register user having a '-', a '_' or a '.' in username

This commit is contained in:
Clément
2017-02-16 14:27:45 +01:00
parent 08857c679d
commit 8d2b76334c
8 changed files with 17 additions and 10 deletions

View File

@@ -103,8 +103,9 @@ class FreshRSS_user_Controller extends Minz_ActionController {
if (!is_array($userConfig)) {
$userConfig = array();
}
$aValid = array('-', '_', '.');
$ok = ($new_user_name != '') && ctype_alnum($new_user_name);
$ok = ($new_user_name != '') && ctype_alnum(str_replace($aValid, '', $new_user_name));
if ($ok) {
$languages = Minz_Translate::availableLanguages();
@@ -187,7 +188,8 @@ class FreshRSS_user_Controller extends Minz_ActionController {
$db = FreshRSS_Context::$system_conf->db;
require_once(APP_PATH . '/SQL/install.sql.' . $db['type'] . '.php');
$ok = ctype_alnum($username);
$aValid = array('-', '_', '.');
$ok = ctype_alnum(str_replace($aValid, '', $username));
if ($ok) {
$default_user = FreshRSS_Context::$system_conf->default_user;
$ok &= (strcasecmp($username, $default_user) !== 0); //It is forbidden to delete the default user