aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/userController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2018-05-26 11:44:17 +0200
committerGravatar GitHub <noreply@github.com> 2018-05-26 11:44:17 +0200
commit4ff6613989a8f1ee2959b4d31466205f00aaec52 (patch)
treeddb0e7b479b1f282788a5f81c34ff627df0aab7e /app/Controllers/userController.php
parentdefbc5d6a54c0c9c98e9ef8e451681ac39757a77 (diff)
Fix CLI for creating/deleting user with Fever API (#1896)
* Fix CLI for creating user with Fever API https://github.com/FreshRSS/FreshRSS/pull/1836 * Fix CLI for deleting user with Fever API https://github.com/FreshRSS/FreshRSS/pull/1836
Diffstat (limited to 'app/Controllers/userController.php')
-rw-r--r--app/Controllers/userController.php22
1 files changed, 3 insertions, 19 deletions
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index e09572b7e..47f0ecc62 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -191,29 +191,15 @@ class FreshRSS_user_Controller extends Minz_ActionController {
$ok &= !file_exists($configPath);
}
if ($ok) {
- $passwordHash = '';
- if ($passwordPlain != '') {
- $passwordHash = self::hashPassword($passwordPlain);
- $ok &= ($passwordHash != '');
- }
-
- $apiPasswordHash = '';
- if ($apiPasswordPlain != '') {
- $apiPasswordHash = self::hashPassword($apiPasswordPlain);
- $ok &= ($apiPasswordHash != '');
- }
- }
- if ($ok) {
if (!is_dir($homeDir)) {
mkdir($homeDir);
}
- $userConfig['passwordHash'] = $passwordHash;
- $userConfig['apiPasswordHash'] = $apiPasswordHash;
$ok &= (file_put_contents($configPath, "<?php\n return " . var_export($userConfig, true) . ';') !== false);
}
if ($ok) {
$userDAO = new FreshRSS_UserDAO();
$ok &= $userDAO->createUser($new_user_name, $userConfig['language'], $insertDefaultFeeds);
+ $ok &= self::updateUser($new_user_name, $passwordPlain, $apiPasswordPlain);
}
return $ok;
}
@@ -268,15 +254,13 @@ class FreshRSS_user_Controller extends Minz_ActionController {
$ok &= (strcasecmp($username, $default_user) !== 0); //It is forbidden to delete the default user
}
$user_data = join_path(DATA_PATH, 'users', $username);
+ $ok &= is_dir($user_data);
if ($ok) {
- $ok &= is_dir($user_data);
- }
- if ($ok) {
+ self::deleteFeverKey($username);
$userDAO = new FreshRSS_UserDAO();
$ok &= $userDAO->deleteUser($username);
$ok &= recursive_unlink($user_data);
array_map('unlink', glob(PSHB_PATH . '/feeds/*/' . $username . '.txt'));
- self::deleteFeverKey();
}
return $ok;
}