diff options
Diffstat (limited to 'apps/sharebymail/lib/ShareByMailProvider.php')
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index c3636f379d8..50338c48830 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -186,16 +186,12 @@ class ShareByMailProvider implements IShareProvider { // if the admin enforces a password for all mail shares we create a // random password and send it to the recipient - $password = $share->getPassword() ?: ''; + $password = ''; $passwordEnforced = $this->settingsManager->enforcePasswordProtection(); - if ($passwordEnforced && empty($password)) { + if ($passwordEnforced) { $password = $this->autoGeneratePassword($share); } - if (!empty($password)) { - $share->setPassword($this->hasher->hash($password)); - } - $shareId = $this->createMailShare($share); $send = $this->sendPassword($share, $password); if ($passwordEnforced && $send === false) { @@ -237,6 +233,8 @@ class ShareByMailProvider implements IShareProvider { $password = $this->secureRandom->generate($passwordLength, $passwordCharset); + $share->setPassword($this->hasher->hash($password)); + return $password; } |