mirror of
https://github.com/nextcloud/server.git
synced 2026-05-28 04:32:30 -04:00
Update old password hashed for link shares on access
Fixes https://github.com/owncloud/core/issues/16594
This commit is contained in:
parent
b4853f3fce
commit
619a4d2e52
2 changed files with 24 additions and 1 deletions
|
|
@ -819,7 +819,9 @@ class Manager implements IManager {
|
|||
}
|
||||
|
||||
if (!empty($newHash)) {
|
||||
//TODO update hash!
|
||||
$share->setPassword($newHash);
|
||||
$provider = $this->factory->getProviderForType($share->getShareType());
|
||||
$provider->update($share);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1645,6 +1645,27 @@ class ManagerTest extends \Test\TestCase {
|
|||
$this->assertTrue($this->manager->checkPassword($share, 'password'));
|
||||
}
|
||||
|
||||
public function testCheckPasswordUpdateShare() {
|
||||
$share = $this->manager->newShare();
|
||||
$share->setShareType(\OCP\Share::SHARE_TYPE_LINK)
|
||||
->setPassword('passwordHash');
|
||||
|
||||
$this->hasher->method('verify')->with('password', 'passwordHash', '')
|
||||
->will($this->returnCallback(function($pass, $hash, &$newHash) {
|
||||
$newHash = 'newHash';
|
||||
|
||||
return true;
|
||||
}));
|
||||
|
||||
$this->defaultProvider->expects($this->once())
|
||||
->method('update')
|
||||
->with($this->callback(function (\OCP\Share\IShare $share) {
|
||||
return $share->getPassword() === 'newHash';
|
||||
}));
|
||||
|
||||
$this->assertTrue($this->manager->checkPassword($share, 'password'));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException Exception
|
||||
* @expectedExceptionMessage The Share API is disabled
|
||||
|
|
|
|||
Loading…
Reference in a new issue