summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorblizzz <blizzz@arthur-schiwon.de>2019-08-21 12:31:12 +0200
committerGitHub <noreply@github.com>2019-08-21 12:31:12 +0200
commit6d20876eb2aae5cb2269c7551e7a4f43e7a31222 (patch)
tree874fc4837b6bb425add34b154ad5ee03a782764f /tests
parentdd02920aedc63e89c8c8cf2e2c41344954bac08c (diff)
parent9c4c5ee8187f169d4d915b9bc84988cca2f6619d (diff)
downloadnextcloud-server-6d20876eb2aae5cb2269c7551e7a4f43e7a31222.tar.gz
nextcloud-server-6d20876eb2aae5cb2269c7551e7a4f43e7a31222.zip
Merge pull request #16782 from nextcloud/fix/16729/stop-if-encrypted-token-null
Stop if there is no encrypted token
Diffstat (limited to 'tests')
-rw-r--r--tests/Core/Controller/LostControllerTest.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/Core/Controller/LostControllerTest.php b/tests/Core/Controller/LostControllerTest.php
index b7ab99e991f..60b96a39081 100644
--- a/tests/Core/Controller/LostControllerTest.php
+++ b/tests/Core/Controller/LostControllerTest.php
@@ -699,6 +699,22 @@ class LostControllerTest extends \Test\TestCase {
$this->assertSame($expectedResponse, $response);
}
+ public function testIsSetPasswordTokenNullFailing() {
+ $this->config->method('getUserValue')
+ ->with('ValidTokenUser', 'core', 'lostpassword', null)
+ ->willReturn(null);
+ $this->userManager->method('get')
+ ->with('ValidTokenUser')
+ ->willReturn($this->existingUser);
+
+ $response = $this->lostController->setPassword('', 'ValidTokenUser', 'NewPassword', true);
+ $expectedResponse = [
+ 'status' => 'error',
+ 'msg' => 'Couldn\'t reset password because the token is invalid'
+ ];
+ $this->assertSame($expectedResponse, $response);
+ }
+
public function testSetPasswordForDisabledUser() {
$user = $this->createMock(IUser::class);
$user->expects($this->any())
@@ -712,7 +728,7 @@ class LostControllerTest extends \Test\TestCase {
->willReturn('encryptedData');
$this->userManager->method('get')
->with('DisabledUser')
- ->willReturn($this->existingUser);
+ ->willReturn($user);
$response = $this->lostController->setPassword('TheOnlyAndOnlyOneTokenToResetThePassword', 'DisabledUser', 'NewPassword', true);
$expectedResponse = [