Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Login/tests/Integration/PasswordResetterTest.php')
-rw-r--r--plugins/Login/tests/Integration/PasswordResetterTest.php23
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);
}
/**