diff options
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Share20/Manager.php | 6 | ||||
-rw-r--r-- | lib/private/Share20/ProviderFactory.php | 1 | ||||
-rw-r--r-- | lib/private/Share20/Share.php | 16 |
3 files changed, 23 insertions, 0 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 3fca9e3fe14..4e87c37fedb 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1552,6 +1552,12 @@ class Manager implements IManager { return false; } + // Makes sure password hasn't expired + $expirationTime = $share->getPasswordExpirationTime(); + if ($expirationTime !== null && $expirationTime < new \DateTime()) { + return false; + } + $newHash = ''; if (!$this->hasher->verify($password, $share->getPassword(), $newHash)) { return false; diff --git a/lib/private/Share20/ProviderFactory.php b/lib/private/Share20/ProviderFactory.php index 42677d6bcf7..434c0017d21 100644 --- a/lib/private/Share20/ProviderFactory.php +++ b/lib/private/Share20/ProviderFactory.php @@ -185,6 +185,7 @@ class ProviderFactory implements IProviderFactory { $settingsManager = new SettingsManager($this->serverContainer->getConfig()); $this->shareByMailProvider = new ShareByMailProvider( + $this->serverContainer->getConfig(), $this->serverContainer->getDatabaseConnection(), $this->serverContainer->getSecureRandom(), $this->serverContainer->getUserManager(), diff --git a/lib/private/Share20/Share.php b/lib/private/Share20/Share.php index f1df71b1143..7ed03832e4c 100644 --- a/lib/private/Share20/Share.php +++ b/lib/private/Share20/Share.php @@ -73,6 +73,7 @@ class Share implements IShare { private $expireDate; /** @var string */ private $password; + private ?\DateTimeInterface $passwordExpirationTime = null; /** @var bool */ private $sendPasswordByTalk = false; /** @var string */ @@ -464,6 +465,21 @@ class Share implements IShare { /** * @inheritdoc */ + public function setPasswordExpirationTime(?\DateTimeInterface $passwordExpirationTime = null): IShare { + $this->passwordExpirationTime = $passwordExpirationTime; + return $this; + } + + /** + * @inheritdoc + */ + public function getPasswordExpirationTime(): ?\DateTimeInterface { + return $this->passwordExpirationTime; + } + + /** + * @inheritdoc + */ public function setSendPasswordByTalk(bool $sendPasswordByTalk) { $this->sendPasswordByTalk = $sendPasswordByTalk; return $this; |