diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-03 09:21:53 +0100 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-12-03 09:21:53 +0100 |
commit | 7fefd4f4d900de85201dafd9848f1212d4f6176d (patch) | |
tree | 20d275d6ebe8d4cc52ce50d3b339bb4f4ffa5c5a /core | |
parent | 6b4f48e0f3ffc7e2f243b232289f7d54a4f8fad5 (diff) | |
parent | dcc7ff09ba4cfba6fe200f4f686cca7a1853390c (diff) | |
download | nextcloud-server-7fefd4f4d900de85201dafd9848f1212d4f6176d.tar.gz nextcloud-server-7fefd4f4d900de85201dafd9848f1212d4f6176d.zip |
Merge pull request #20860 from owncloud/use-user-getEMailAddress-all-over-the-place
User IUser::getEMailAddress() all over the place
Diffstat (limited to 'core')
-rw-r--r-- | core/ajax/share.php | 20 | ||||
-rw-r--r-- | core/lostpassword/controller/lostcontroller.php | 7 |
2 files changed, 16 insertions, 11 deletions
diff --git a/core/ajax/share.php b/core/ajax/share.php index fd42a94de6e..e9bbef172af 100644 --- a/core/ajax/share.php +++ b/core/ajax/share.php @@ -35,6 +35,8 @@ * */ +use OCP\IUser; + OC_JSON::checkLoggedIn(); OCP\JSON::callCheck(); @@ -135,17 +137,23 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $itemSource = (string)$_POST['itemSource']; $recipient = (string)$_POST['recipient']; + $userManager = \OC::$server->getUserManager(); + $recipientList = []; if($shareType === \OCP\Share::SHARE_TYPE_USER) { - $recipientList[] = $recipient; + $recipientList[] = $userManager->get($recipient); } elseif ($shareType === \OCP\Share::SHARE_TYPE_GROUP) { $recipientList = \OC_Group::usersInGroup($recipient); + $group = \OC::$server->getGroupManager()->get($recipient); + $recipientList = $group->searchUsers(''); } // don't send a mail to the user who shared the file - $recipientList = array_diff($recipientList, array(\OCP\User::getUser())); + $recipientList = array_filter($recipientList, function($user) { + /** @var IUser $user */ + return $user->getUID() !== \OCP\User::getUser(); + }); $mailNotification = new \OC\Share\MailNotifications( - \OC::$server->getUserSession()->getUser()->getUID(), - \OC::$server->getConfig(), + \OC::$server->getUserSession()->getUser(), \OC::$server->getL10N('lib'), \OC::$server->getMailer(), \OC::$server->getLogger(), @@ -183,8 +191,7 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo $to_address = (string)$_POST['toaddress']; $mailNotification = new \OC\Share\MailNotifications( - \OC::$server->getUserSession()->getUser()->getUID(), - \OC::$server->getConfig(), + \OC::$server->getUserSession()->getUser(), \OC::$server->getL10N('lib'), \OC::$server->getMailer(), \OC::$server->getLogger(), @@ -199,7 +206,6 @@ if (isset($_POST['action']) && isset($_POST['itemType']) && isset($_POST['itemSo } catch (Exception $e) { \OCP\Util::writeLog('sharing', "Couldn't read date: " . $e->getMessage(), \OCP\Util::ERROR); } - } $result = $mailNotification->sendLinkShareMail($to_address, $file, $link, $expiration); diff --git a/core/lostpassword/controller/lostcontroller.php b/core/lostpassword/controller/lostcontroller.php index 7d983bd7e30..0cd6fcd30a4 100644 --- a/core/lostpassword/controller/lostcontroller.php +++ b/core/lostpassword/controller/lostcontroller.php @@ -218,13 +218,12 @@ class LostController extends Controller { throw new \Exception($this->l10n->t('Couldn\'t send reset email. Please make sure your username is correct.')); } - $email = $this->config->getUserValue($user, 'settings', 'email'); + $userObject = $this->userManager->get($user); + $email = $userObject->getEMailAddress(); if (empty($email)) { throw new \Exception( - $this->l10n->t('Couldn\'t send reset email because there is no '. - 'email address for this username. Please ' . - 'contact your administrator.') + $this->l10n->t('Could not send reset email because there is no email address for this username. Please contact your administrator.') ); } |