summaryrefslogtreecommitdiffstats
path: root/lib/private/Share20/Manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Share20/Manager.php')
-rw-r--r--lib/private/Share20/Manager.php12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php
index 76b523afd10..d0316b44c1a 100644
--- a/lib/private/Share20/Manager.php
+++ b/lib/private/Share20/Manager.php
@@ -827,10 +827,20 @@ class Manager implements IManager {
$expirationDateUpdated = true;
}
} else if ($share->getShareType() === \OCP\Share::SHARE_TYPE_EMAIL) {
+ // The new password is not set again if it is the same as the old
+ // one, unless when switching from sending by Talk to sending by
+ // mail.
$plainTextPassword = $share->getPassword();
- if (!$this->updateSharePasswordIfNeeded($share, $originalShare)) {
+ if (!empty($plainTextPassword) && !$this->updateSharePasswordIfNeeded($share, $originalShare) &&
+ !($originalShare->getSendPasswordByTalk() && !$share->getSendPasswordByTalk())) {
$plainTextPassword = null;
}
+ if (empty($plainTextPassword) && !$originalShare->getSendPasswordByTalk() && $share->getSendPasswordByTalk()) {
+ // If the same password was already sent by mail the recipient
+ // would already have access to the share without having to call
+ // the sharer to verify her identity
+ throw new \InvalidArgumentException('Can’t enable sending the password by Talk without setting a new password');
+ }
}
$this->pathCreateChecks($share->getNode());