Skip to content
This repository has been archived by the owner on Sep 23, 2023. It is now read-only.

Commit

Permalink
Merge pull request #682 from owncloud/butonic-patch-1
Browse files Browse the repository at this point in the history
[stable9] Fix of issue #23066
  • Loading branch information
oparoz authored Jul 8, 2016
2 parents 728a523 + bedf21f commit 2df541e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions middleware/envcheckmiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ private function checkPassword($linkItem, $password) {
$newHash = '';
if ($this->hasher->verify($password, $linkItem['share_with'], $newHash)) {
// Save item id in session for future requests
$this->session->set('public_link_authenticated', $linkItem['id']);
$this->session->set('public_link_authenticated', (string)$linkItem['id']);
// @codeCoverageIgnoreStart
if (!empty($newHash)) {
// For future use
Expand All @@ -312,7 +312,7 @@ private function checkPassword($linkItem, $password) {
private function checkSession($linkItem) {
// Not authenticated ?
if (!$this->session->exists('public_link_authenticated')
|| $this->session->get('public_link_authenticated') !== $linkItem['id']
|| $this->session->get('public_link_authenticated') !== (string)$linkItem['id']
) {
throw new CheckException("Missing password", Http::STATUS_UNAUTHORIZED);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/middleware/EnvCheckMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,8 @@ public function testBeforeControllerWithGuestNotation() {

public function testCheckSessionAfterPasswordEntry() {
$linkItem['id'] = 12345;
$this->mockSessionExists($linkItem['id']);
$this->mockSessionWithLinkItemId($linkItem['id']);
$this->mockSessionExists((string)$linkItem['id']);
$this->mockSessionWithLinkItemId((string)$linkItem['id']);

self::invokePrivate($this->middleware, 'checkSession', [$linkItem]);
}
Expand Down Expand Up @@ -387,8 +387,8 @@ public function testCheckAuthorisationWithNoPassword() {
'id' => 12345,
'share_with' => 'Empyrion Galactic Survival'
];
$this->mockSessionExists($linkItem['id']);
$this->mockSessionWithLinkItemId($linkItem['id']);
$this->mockSessionExists((string)$linkItem['id']);
$this->mockSessionWithLinkItemId((string)$linkItem['id']);

self::invokePrivate($this->middleware, 'checkAuthorisation', [$linkItem, $password]);
}
Expand Down

0 comments on commit 2df541e

Please sign in to comment.