Browse Source

Correct CLI password clearing

microsub
J. King 5 years ago
parent
commit
9c61f967e3
  1. 8
      CHANGELOG
  2. 4
      lib/CLI.php
  3. 4
      tests/cases/CLI/TestCLI.php

8
CHANGELOG

@ -1,3 +1,11 @@
Version 0.8.0 (2019-??-??)
==========================
New features:
- Support for the Fever protocol (see README.md for details)
- Command line functionality for clearing a password, disabling the account
- Command line options for dealing with Fever passwords
Version 0.7.1 (2019-03-25)
==========================

4
lib/CLI.php

@ -115,7 +115,7 @@ USAGE_TEXT;
}
protected function userManage($args): int {
switch ($this->command(["add", "remove", "set-pass", "list", "auth"], $args)) {
switch ($this->command(["add", "remove", "set-pass", "unset-pass", "list", "auth"], $args)) {
case "add":
return $this->userAddOrSetPassword("add", $args["<username>"], $args["<password>"]);
case "set-pass":
@ -130,7 +130,7 @@ USAGE_TEXT;
}
case "unset-pass":
if ($args['--fever']) {
$this->getFever()->unegister($args["<username>"]);
$this->getFever()->unregister($args["<username>"]);
} else {
Arsse::$user->passwordUnset($args["<username>"], $args["--oldpass"]);
}

4
tests/cases/CLI/TestCLI.php

@ -261,9 +261,9 @@ class TestCLI extends \JKingWeb\Arsse\Test\AbstractTest {
};
// FIXME: Phake is somehow unable to mock the User class correctly, so we use PHPUnit's mocks instead
Arsse::$user = $this->createMock(User::class);
Arsse::$user->method("passwordUnet")->will($this->returnCallback($passwordChange));
Arsse::$user->method("passwordUnset")->will($this->returnCallback($passwordClear));
$fever = \Phake::mock(FeverUser::class);
\Phake::when($fever)->unregister->thenReturnCallback($passwordChange);
\Phake::when($fever)->unregister->thenReturnCallback($passwordClear);
\Phake::when($this->cli)->getFever->thenReturn($fever);
$this->assertConsole($this->cli, $cmd, $exitStatus, $output);
}

Loading…
Cancel
Save