diff options
author | sgiehl <stefan@matomo.org> | 2020-07-24 14:11:05 +0300 |
---|---|---|
committer | sgiehl <stefan@matomo.org> | 2020-07-24 15:28:48 +0300 |
commit | 679e73f1236969db0c2d767655cb84456a727d24 (patch) | |
tree | 648722fa79cb524f8819857e79163e0c1cf16d59 /plugins/Login/tests/Integration/PasswordResetterTest.php | |
parent | 6b5f8138180716d5088d764f0b41d5787159b28a (diff) | |
parent | 3e1234a887f56a1cf853e29ba89370b234af5127 (diff) |
Merge branch '3.x-dev' into 4.x-dev
Diffstat (limited to 'plugins/Login/tests/Integration/PasswordResetterTest.php')
-rw-r--r-- | plugins/Login/tests/Integration/PasswordResetterTest.php | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/plugins/Login/tests/Integration/PasswordResetterTest.php b/plugins/Login/tests/Integration/PasswordResetterTest.php index fe6f3f0b31..b600d031c4 100644 --- a/plugins/Login/tests/Integration/PasswordResetterTest.php +++ b/plugins/Login/tests/Integration/PasswordResetterTest.php @@ -54,19 +54,7 @@ class PasswordResetterTest extends IntegrationTestCase public function test_passwordReset_processWorksAsExpected() { - $user = $this->userModel->getUser('superUserLogin'); - $password = $user['password']; - $passwordModified = $user['ts_password_modified']; - - $this->passwordResetter->initiatePasswordResetProcess('superUserLogin', self::NEWPASSWORD); - - $this->assertNotEmpty($this->capturedToken); - - $user = $this->userModel->getUser('superUserLogin'); - $this->assertEquals($password, $user['password']); - $this->assertEquals($passwordModified, $user['ts_password_modified']); - - $this->passwordResetter->confirmNewPassword('superUserLogin', $this->capturedToken); + $this->passwordResetter->setHashedPasswordForLogin('superUserLogin', $this->capturedToken); $this->checkPasswordIs(self::NEWPASSWORD); } @@ -118,6 +106,9 @@ class PasswordResetterTest extends IntegrationTestCase Option::set($optionName, json_encode($data)); + $this->assertTrue($this->passwordResetter->doesResetPasswordHashMatchesPassword(self::NEWPASSWORD, $data['hash'])); + $this->assertFalse($this->passwordResetter->doesResetPasswordHashMatchesPassword('foobar', $data['hash'])); + $this->passwordResetter->initiatePasswordResetProcess('superUserLogin', self::NEWPASSWORD); $optionName = $this->passwordResetter->getPasswordResetInfoOptionName('superUserLogin'); @@ -134,7 +125,7 @@ class PasswordResetterTest extends IntegrationTestCase $this->passwordResetter->initiatePasswordResetProcess('superUserLogin', self::NEWPASSWORD); $this->assertNotEmpty($this->capturedToken); - $this->passwordResetter->confirmNewPassword('superUserLogin', $this->capturedToken); + $this->passwordResetter->checkValidConfirmPasswordToken('superUserLogin', $this->capturedToken); $this->checkPasswordIs(self::NEWPASSWORD); sleep(1); @@ -143,7 +134,7 @@ class PasswordResetterTest extends IntegrationTestCase $this->passwordResetter->initiatePasswordResetProcess('superUserLogin', 'anotherpassword'); $this->assertNotEquals($oldCapturedToken, $this->capturedToken); - $this->passwordResetter->confirmNewPassword('superUserLogin', $oldCapturedToken); + $this->passwordResetter->checkValidConfirmPasswordToken('superUserLogin', $oldCapturedToken); } public function test_passwordReset_shouldNeverGenerateTheSameToken() @@ -172,7 +163,7 @@ class PasswordResetterTest extends IntegrationTestCase $this->passwordResetter->initiatePasswordResetProcess('superUserLogin', self::NEWPASSWORD); $this->assertNotEquals($oldCapturedToken, $this->capturedToken); - $this->passwordResetter->confirmNewPassword('superUserLogin', $oldCapturedToken); + $this->passwordResetter->checkValidConfirmPasswordToken('superUserLogin', $oldCapturedToken); } /** |