diff options
author | Joas Schilling <coding@schilljs.com> | 2016-08-23 12:54:45 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2016-08-23 12:54:45 +0200 |
commit | 139fb8de9471e83155c141640ce91c66d42d7b28 (patch) | |
tree | afcf2b471acd10ff729dd70bd714c2393bfbbfc3 /tests/Core/Controller/LoginControllerTest.php | |
parent | 24f12cc8c01f1f286c272dce1dda108b01846b18 (diff) | |
download | nextcloud-server-139fb8de9471e83155c141640ce91c66d42d7b28.tar.gz nextcloud-server-139fb8de9471e83155c141640ce91c66d42d7b28.zip |
Remove "password reset token" after successful login
Diffstat (limited to 'tests/Core/Controller/LoginControllerTest.php')
-rw-r--r-- | tests/Core/Controller/LoginControllerTest.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/Core/Controller/LoginControllerTest.php b/tests/Core/Controller/LoginControllerTest.php index 8eaa7c9843b..7fcc8222bc3 100644 --- a/tests/Core/Controller/LoginControllerTest.php +++ b/tests/Core/Controller/LoginControllerTest.php @@ -322,6 +322,8 @@ class LoginControllerTest extends TestCase { $this->userSession->expects($this->never()) ->method('createSessionToken'); + $this->config->expects($this->never()) + ->method('deleteUserValue'); $expected = new \OCP\AppFramework\Http\RedirectResponse($loginPageUrl); $this->assertEquals($expected, $this->loginController->tryLogin($user, $password, '')); @@ -330,6 +332,9 @@ class LoginControllerTest extends TestCase { public function testLoginWithValidCredentials() { /** @var IUser | \PHPUnit_Framework_MockObject_MockObject $user */ $user = $this->getMockBuilder('\OCP\IUser')->getMock(); + $user->expects($this->any()) + ->method('getUID') + ->will($this->returnValue('uid')); $password = 'secret'; $indexPageUrl = \OC_Util::getDefaultPageUrl(); @@ -363,6 +368,9 @@ class LoginControllerTest extends TestCase { ->method('isTwoFactorAuthenticated') ->with($user) ->will($this->returnValue(false)); + $this->config->expects($this->once()) + ->method('deleteUserValue') + ->with('uid', 'owncloud', 'lostpassword'); $expected = new \OCP\AppFramework\Http\RedirectResponse($indexPageUrl); $this->assertEquals($expected, $this->loginController->tryLogin($user, $password, null)); @@ -398,6 +406,8 @@ class LoginControllerTest extends TestCase { ->method('isLoggedIn') ->with() ->will($this->returnValue(false)); + $this->config->expects($this->never()) + ->method('deleteUserValue'); $expected = new \OCP\AppFramework\Http\RedirectResponse(\OC_Util::getDefaultPageUrl()); $this->assertEquals($expected, $this->loginController->tryLogin('Jane', $password, $originalUrl)); @@ -438,6 +448,8 @@ class LoginControllerTest extends TestCase { ->method('getAbsoluteURL') ->with(urldecode($originalUrl)) ->will($this->returnValue($redirectUrl)); + $this->config->expects($this->never()) + ->method('deleteUserValue'); $expected = new \OCP\AppFramework\Http\RedirectResponse($redirectUrl); $this->assertEquals($expected, $this->loginController->tryLogin('Jane', $password, $originalUrl)); @@ -485,6 +497,9 @@ class LoginControllerTest extends TestCase { ->method('getAbsoluteURL') ->with(urldecode($originalUrl)) ->will($this->returnValue($redirectUrl)); + $this->config->expects($this->once()) + ->method('deleteUserValue') + ->with('jane', 'owncloud', 'lostpassword'); $expected = new \OCP\AppFramework\Http\RedirectResponse(urldecode($redirectUrl)); $this->assertEquals($expected, $this->loginController->tryLogin('Jane', $password, $originalUrl)); @@ -536,6 +551,9 @@ class LoginControllerTest extends TestCase { ->method('linkToRoute') ->with('core.TwoFactorChallenge.selectChallenge') ->will($this->returnValue($challengeUrl)); + $this->config->expects($this->once()) + ->method('deleteUserValue') + ->with('john', 'owncloud', 'lostpassword'); $expected = new RedirectResponse($challengeUrl); $this->assertEquals($expected, $this->loginController->tryLogin('john@doe.com', $password, null)); @@ -586,6 +604,8 @@ class LoginControllerTest extends TestCase { ->expects($this->once()) ->method('registerAttempt') ->with('login', '192.168.0.1', ['user' => 'john@doe.com']); + $this->config->expects($this->never()) + ->method('deleteUserValue'); $expected = new RedirectResponse(''); $this->assertEquals($expected, $this->loginController->tryLogin('john@doe.com', 'just wrong', null)); |