summaryrefslogtreecommitdiffstats
path: root/apps/sharebymail/lib
diff options
context:
space:
mode:
Diffstat (limited to 'apps/sharebymail/lib')
-rw-r--r--apps/sharebymail/lib/ShareByMailProvider.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php
index 1aa2307a27d..ccfebe0bded 100644
--- a/apps/sharebymail/lib/ShareByMailProvider.php
+++ b/apps/sharebymail/lib/ShareByMailProvider.php
@@ -198,7 +198,7 @@ class ShareByMailProvider implements IShareProvider {
// Sends share password to receiver when it's a permanent one (otherwise she will have to request it via the showShare UI)
// or to owner when the password shall be given during a Talk session
- if ($this->config->getSystemValue('sharing.enable_mail_link_password_expiration', false) === true || $share->getSendPasswordByTalk()) {
+ if ($this->config->getSystemValue('sharing.enable_mail_link_password_expiration', false) === false || $share->getSendPasswordByTalk()) {
$send = $this->sendPassword($share, $password);
if ($passwordEnforced && $send === false) {
$this->sendPasswordToOwner($share, $password);
@@ -503,6 +503,13 @@ class ShareByMailProvider implements IShareProvider {
$emailTemplate->addBodyText($this->l->t('It is protected with the following password:'));
$emailTemplate->addBodyText($password);
+ if ($this->config->getSystemValue('sharing.enable_mail_link_password_expiration', false) === true) {
+ $expirationTime = new \DateTime();
+ $expirationInterval = $this->config->getSystemValue('sharing.mail_link_password_expiration_interval', 3600);
+ $expirationTime = $expirationTime->add(new \DateInterval('PT' . $expirationInterval . 'S'));
+ $emailTemplate->addBodyText($this->l->t('This password will expire at %s', [$expirationTime->format('r')]));
+ }
+
// The "From" contains the sharers name
$instanceName = $this->defaults->getName();
$senderName = $instanceName;
@@ -627,7 +634,16 @@ class ShareByMailProvider implements IShareProvider {
$emailTemplate->addBodyText($bodyPart);
$emailTemplate->addBodyText($this->l->t('This is the password:'));
$emailTemplate->addBodyText($password);
+
+ if ($this->config->getSystemValue('sharing.enable_mail_link_password_expiration', false) === true) {
+ $expirationTime = new \DateTime();
+ $expirationInterval = $this->config->getSystemValue('sharing.mail_link_password_expiration_interval', 3600);
+ $expirationTime = $expirationTime->add(new \DateInterval('PT' . $expirationInterval . 'S'));
+ $emailTemplate->addBodyText($this->l->t('This password will expire at %s', [$expirationTime->format('r')]));
+ }
+
$emailTemplate->addBodyText($this->l->t('You can choose a different password at any time in the share dialog.'));
+
$emailTemplate->addFooter();
$instanceName = $this->defaults->getName();