1
1
Fork 0
mirror of https://code.mensbeam.com/MensBeam/Arsse.git synced 2024-12-22 21:22:40 +00:00

Correct CLI password clearing

This commit is contained in:
J. King 2019-03-25 17:07:28 -04:00
parent 54be5997d1
commit 9c61f967e3
3 changed files with 12 additions and 4 deletions

View file

@ -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) Version 0.7.1 (2019-03-25)
========================== ==========================

View file

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

View file

@ -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 // 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 = $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); $fever = \Phake::mock(FeverUser::class);
\Phake::when($fever)->unregister->thenReturnCallback($passwordChange); \Phake::when($fever)->unregister->thenReturnCallback($passwordClear);
\Phake::when($this->cli)->getFever->thenReturn($fever); \Phake::when($this->cli)->getFever->thenReturn($fever);
$this->assertConsole($this->cli, $cmd, $exitStatus, $output); $this->assertConsole($this->cli, $cmd, $exitStatus, $output);
} }