Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for password resetter and tweak process a bit. #13523

Merged
merged 5 commits into from Oct 12, 2018

Conversation

diosmosis
Copy link
Member

@diosmosis diosmosis commented Oct 3, 2018

TODO:

  • manual test

Fixes #13519
Fixes #13520

@diosmosis diosmosis added the Needs Review PRs that need a code review label Oct 3, 2018
@diosmosis diosmosis added this to the 3.6.1 milestone Oct 3, 2018
@sgiehl
Copy link
Member

sgiehl commented Oct 3, 2018

will your changes also fix #13519?

@diosmosis
Copy link
Member Author

@sgiehl I haven't tested, but I believe so, will add to description.

@@ -274,7 +280,7 @@ public function generatePasswordResetToken($user, $expiryTimestamp = null)

$expiry = strftime('%Y%m%d%H', $expiryTimestamp);
$token = $this->generateSecureHash(
$expiry . $user['login'] . $user['email'],
$expiry . $user['login'] . $user['email'] . $user['ts_password_modified'] . $resetTime,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to include something random here? like Common::getRandomString()?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I can use a random string instead of the reset time.

@diosmosis
Copy link
Member Author

Verified will fix #13519

use Piwik\AuthResult;
use Piwik\Container\StaticContainer;
use Piwik\Mail;
use Piwik\Plugins\Cloud\tests\Framework\TestCase\IntegrationTestCase;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's the wrong one

@diosmosis
Copy link
Member Author

Updated.

@sgiehl
Copy link
Member

sgiehl commented Oct 11, 2018

Tests are still failing on travis

@@ -175,11 +176,12 @@ public function initiatePasswordResetProcess($loginOrEmail, $newPassword)

$login = $user['login'];

$this->savePasswordResetInfo($login, $newPassword);
$keySuffix = time() . Common::getRandomString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diosmosis I reckon the only thing I'd change is to use Common::getRandomString($len = 32) just to have even more randomness. Otherwise looks good to me and it worked 👍

@diosmosis diosmosis merged commit 8ba828c into 3.x-dev Oct 12, 2018
@diosmosis diosmosis deleted the reset-password-changes branch October 12, 2018 02:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Review PRs that need a code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants