Skip to content

Commit

Permalink
Fix leak of unclaimed user ID in UsersEmailApiHandler
Browse files Browse the repository at this point in the history
remp/hiking#10
  • Loading branch information
rootpd committed Feb 6, 2022
1 parent de42a94 commit a14b7f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Api/UsersEmailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public function handle(ApiAuthorizationInterface $authorization)
$status = 'taken';
$passwordStatus = ($params['password']) ? false : null;
} elseif ($authException->getCode() === UserAuthenticator::NOT_APPROVED) {
$user = null;
$status = 'available';
} else {
$status = 'taken';
Expand Down
4 changes: 2 additions & 2 deletions src/Tests/UsersEmailHandlerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ public function testUnclaimedUser()

$this->assertEquals('available', $payload['status']);
$this->assertEquals($email, $payload['email']);
$this->assertEquals($user->id, $payload['id']);
$this->assertEquals(null, $payload['password']);
$this->assertNull($payload['id']);
$this->assertNull($payload['password']);
$this->assertEquals(LoginAttemptsRepository::STATUS_UNCLAIMED_USER, $lastAttempt->status);
}

Expand Down

0 comments on commit a14b7f8

Please sign in to comment.