diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-04-14 17:51:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-14 17:51:13 +0200 |
commit | 396db12e8e97af033cff6dc0adaf13ee78ec5c3b (patch) | |
tree | e4be97be3aebb56e9d7f177361eeec71e6dbaee0 /lib/private | |
parent | 0824f440f0007bdf1665e4a8d5b9fc482e235e9f (diff) | |
parent | 82f1344d334431877cf84fc00b76563a48f01c5a (diff) | |
download | nextcloud-server-396db12e8e97af033cff6dc0adaf13ee78ec5c3b.tar.gz nextcloud-server-396db12e8e97af033cff6dc0adaf13ee78ec5c3b.zip |
Merge pull request #31975 from nextcloud/bugfix/31952/fix-mail-link-share-password-expiration-settings
Adjust settings for mail link password
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Share20/Manager.php | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index 191b59d2b88..aab69eae597 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -1175,29 +1175,17 @@ class Manager implements IManager { * Set the share's password expiration time */ private function setSharePasswordExpirationTime(IShare $share): void { - if ($this->config->getSystemValue('allow_mail_share_permanent_password', true)) { + if (!$this->config->getSystemValue('sharing.enable_mail_link_password_expiration', false)) { // Sets password expiration date to NULL $share->setPasswordExpirationTime(); return; } // Sets password expiration date $expirationTime = null; - try { - $now = new \DateTime(); - $expirationInterval = $this->config->getSystemValue('share_temporary_password_expiration_interval'); - if ($expirationInterval === '' || is_null($expirationInterval)) { - $expirationInterval = 'P0DT15M'; - } - $expirationTime = $now->add(new \DateInterval($expirationInterval)); - } catch (\Exception $e) { - // Catches invalid format for system value 'share_temporary_password_expiration_interval' - \OC::$server->getLogger()->logException($e, [ - 'message' => 'The \'share_temporary_password_expiration_interval\' system setting does not respect the DateInterval::__construct() format. Setting it to \'P0DT15M\'' - ]); - $expirationTime = $now->add(new \DateInterval('P0DT15M')); - } finally { - $share->setPasswordExpirationTime($expirationTime); - } + $now = new \DateTime(); + $expirationInterval = $this->config->getSystemValue('sharing.mail_link_password_expiration_interval', 3600); + $expirationTime = $now->add(new \DateInterval('PT' . $expirationInterval . 'S')); + $share->setPasswordExpirationTime($expirationTime); } |