aboutsummaryrefslogtreecommitdiff
path: root/cli/create-user.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-10-01 18:31:28 +0200
committerGravatar GitHub <noreply@github.com> 2017-10-01 18:31:28 +0200
commitceda55c75b158fc1cf4813fe0f258527754b9289 (patch)
tree7c84ac32cc845ab1d70ea5a3fb263c6613de34b0 /cli/create-user.php
parentcb7ba3e47576aa1d0c3f53e5966f831e6540bbc3 (diff)
parentf241fc1841df89285ecb6f124f0d70198d712b2f (diff)
Merge pull request #1651 from FreshRSS/dev1.8.0
Release 1.8.0
Diffstat (limited to 'cli/create-user.php')
-rwxr-xr-xcli/create-user.php29
1 files changed, 7 insertions, 22 deletions
diff --git a/cli/create-user.php b/cli/create-user.php
index c9e350c14..1b6be3153 100755
--- a/cli/create-user.php
+++ b/cli/create-user.php
@@ -1,24 +1,12 @@
#!/usr/bin/php
<?php
-require('_cli.php');
-
-$options = getopt('', array(
- 'user:',
- 'password:',
- 'api-password:',
- 'language:',
- 'email:',
- 'token:',
- 'no-default-feeds',
- ));
-
-if (empty($options['user'])) {
- fail('Usage: ' . basename(__FILE__) . " --user username ( --password 'password' --api-password 'api_password'" .
- " --language en --email user@example.net --token 'longRandomString --no-default-feeds' )");
-}
+$isUpdate = false;
+require('_update-or-create-user.php');
+
$username = $options['user'];
if (!FreshRSS_user_Controller::checkUsername($username)) {
- fail('FreshRSS error: invalid username “' . $username . '”');
+ fail('FreshRSS error: invalid username “' . $username .
+ '”! Must be matching ' . FreshRSS_user_Controller::USERNAME_PATTERN);
}
$usernames = listUsers();
@@ -30,11 +18,8 @@ echo 'FreshRSS creating user “', $username, "”…\n";
$ok = FreshRSS_user_Controller::createUser($username,
empty($options['password']) ? '' : $options['password'],
- empty($options['api-password']) ? '' : $options['api-password'],
- array(
- 'language' => empty($options['language']) ? '' : $options['language'],
- 'token' => empty($options['token']) ? '' : $options['token'],
- ),
+ empty($options['api_password']) ? '' : $options['api_password'],
+ $values,
!isset($options['no-default-feeds']));
if (!$ok) {