Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-04-13 16:46:30 +0300
committerVincent Petry <vincent@nextcloud.com>2022-04-13 16:46:30 +0300
commitf5c8fa4f11b70d84c593c6102f3100a94310fa34 (patch)
tree4766d7e1d8708d612c13eb33d4b1408b6f262842 /apps/files_sharing/lib
parentcd95fce105fe5f0e71b1bcac7685464f936b9749 (diff)
Properly reset pw expiration
When requesting a new password for share by mail link, now we correctly reset the expiration date. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r--apps/files_sharing/lib/Controller/ShareAPIController.php36
1 files changed, 0 insertions, 36 deletions
diff --git a/apps/files_sharing/lib/Controller/ShareAPIController.php b/apps/files_sharing/lib/Controller/ShareAPIController.php
index d324af3e9f2..c0441485132 100644
--- a/apps/files_sharing/lib/Controller/ShareAPIController.php
+++ b/apps/files_sharing/lib/Controller/ShareAPIController.php
@@ -571,10 +571,6 @@ class ShareAPIController extends OCSController {
// Set password
if ($password !== '') {
$share->setPassword($password);
- // Shares shared by email have temporary passwords by default
- if ($shareType === IShare::TYPE_EMAIL) {
- $this->setSharePasswordExpirationTime($share);
- }
}
// Only share by mail have a recipient
@@ -1182,9 +1178,6 @@ class ShareAPIController extends OCSController {
$share->setPassword(null);
} elseif ($password !== null) {
$share->setPassword($password);
- if ($share->getShareType() === IShare::TYPE_EMAIL) {
- $this->setSharePasswordExpirationTime($share);
- }
}
if ($label !== null) {
@@ -1522,35 +1515,6 @@ class ShareAPIController extends OCSController {
}
/**
- * Set the share's password expiration time
- */
- private function setSharePasswordExpirationTime(IShare $share): void {
- if ($this->config->getSystemValue('allow_mail_share_permanent_password')) {
- // 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);
- }
- }
-
- /**
* Since we have multiple providers but the OCS Share API v1 does
* not support this we need to check all backends.
*