diff options
| author | 2017-02-16 14:27:45 +0100 | |
|---|---|---|
| committer | 2017-02-16 14:27:45 +0100 | |
| commit | 8d2b76334cd60356c85810bf4902124105d54ad4 (patch) | |
| tree | a303e6f209fd716972ca3421c4b817beec0cabfc /cli | |
| parent | 08857c679d700b982a1af21ce11c4b25e125e44a (diff) | |
Possibility to register user having a '-', a '_' or a '.' in username
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/_cli.php | 4 | ||||
| -rwxr-xr-x | cli/delete-user.php | 3 | ||||
| -rwxr-xr-x | cli/do-install.php | 3 |
3 files changed, 7 insertions, 3 deletions
diff --git a/cli/_cli.php b/cli/_cli.php index 7d1a7c6b2..885199659 100644 --- a/cli/_cli.php +++ b/cli/_cli.php @@ -20,7 +20,9 @@ function fail($message) { } function cliInitUser($username) { - if (!ctype_alnum($username)) { + $aValid = array('-', '_', '.'); + + if (!ctype_alnum(str_replace($aValid, '', $username))) { fail('FreshRSS error: invalid username: ' . $username . "\n"); } diff --git a/cli/delete-user.php b/cli/delete-user.php index 6f0e86e17..82605fb27 100755 --- a/cli/delete-user.php +++ b/cli/delete-user.php @@ -9,8 +9,9 @@ $options = getopt('', array( if (empty($options['user'])) { fail('Usage: ' . basename(__FILE__) . " --user username"); } +$aValid = array('-', '_', '.'); $username = $options['user']; -if (!ctype_alnum($username)) { +if (!ctype_alnum(str_replace($aValid, '', $username))) { fail('FreshRSS error: invalid username “' . $username . '”'); } diff --git a/cli/do-install.php b/cli/do-install.php index 100d4947f..eb46c7e93 100755 --- a/cli/do-install.php +++ b/cli/do-install.php @@ -47,7 +47,8 @@ if ($requirements['all'] !== 'ok') { fail($message); } -if (!ctype_alnum($options['default_user'])) { +$aValid = array('-', '_', '.'); +if (!ctype_alnum(str_replace($aValid, '', $options['default_user']))) { fail('FreshRSS invalid default username (must be ASCII alphanumeric): ' . $options['default_user']); } |
