diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-04-14 14:06:25 +0200 |
---|---|---|
committer | Vincent Petry <vincent@nextcloud.com> | 2022-04-14 14:13:47 +0200 |
commit | 82f1344d334431877cf84fc00b76563a48f01c5a (patch) | |
tree | c5ae99eb46a1b62828ddb93a909bbb86d7a5bc0c /lib/private/Share20 | |
parent | e827e0a14061a08eb6009e3fa222c2e66a4ffaf6 (diff) | |
download | nextcloud-server-82f1344d334431877cf84fc00b76563a48f01c5a.tar.gz nextcloud-server-82f1344d334431877cf84fc00b76563a48f01c5a.zip |
Adjust settings for mail link password
Rename the settings and invert the meaning.
Increase default interval to one hour.
Changed the interval to be a number of seconds, to align with other
setting styles.
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'lib/private/Share20')
-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); } |