diff options
author | Cyrille Bollu <cyrpub@bollu.be> | 2022-04-14 22:08:53 +0300 |
---|---|---|
committer | nextcloud-command <nextcloud-command@users.noreply.github.com> | 2022-06-08 14:29:19 +0300 |
commit | 50badb3fb6b6a7fa51520ce380ece09b0a181179 (patch) | |
tree | 019251a34dc4732f382f54d5122891a2ad95e54f /apps/sharebymail/lib | |
parent | b7bce42078369fc48df8234fb8e2f110f7b6484d (diff) |
Various improvements related to the recent implementation of temporary passwords
for mail shares:
1- Changes style of "forgot password?" and "Back" button
2- Adds information about share password's expiration time in the emails sent.
3- Shows password expiration time in the Share menu
4- Fixes an issue when the message "Password expires..." would be shown for non email share types (which don't have temporary passswords)
5- At share's creation, password should only be sent when it's a permanent one
See also https://github.com/nextcloud/server/issues/31952
Signed-off-by: Cyrille Bollu <cyrpub@bollu.be>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
Diffstat (limited to 'apps/sharebymail/lib')
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 18 |
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(); |