diff options
author | Joas Schilling <coding@schilljs.com> | 2017-04-13 12:34:02 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-04-13 12:34:02 +0200 |
commit | 1110b51aa3c7627855d775e6122cb27553118944 (patch) | |
tree | ab33c1f8607279c3e6aee2f56c78baa631cc03fc /lib/private | |
parent | 0eb08a510b7393da0067750e01cdae8a4d1d009a (diff) | |
download | nextcloud-server-1110b51aa3c7627855d775e6122cb27553118944.tar.gz nextcloud-server-1110b51aa3c7627855d775e6122cb27553118944.zip |
Allow to read the old email on the hook as well
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/private')
-rw-r--r-- | lib/private/Server.php | 4 | ||||
-rw-r--r-- | lib/private/User/User.php | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php index 00698a04f89..43cc62296a6 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -343,9 +343,9 @@ class Server extends ServerContainer implements IServerContainer { $userSession->listen('\OC\User', 'logout', function () { \OC_Hook::emit('OC_User', 'logout', array()); }); - $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value) { + $userSession->listen('\OC\User', 'changeUser', function ($user, $feature, $value, $oldValue) { /** @var $user \OC\User\User */ - \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value)); + \OC_Hook::emit('OC_User', 'changeUser', array('run' => true, 'user' => $user, 'feature' => $feature, 'value' => $value, 'old_value' => $oldValue)); }); return $userSession; }); diff --git a/lib/private/User/User.php b/lib/private/User/User.php index bca9c46bfd0..a3be0c24bb9 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -158,12 +158,13 @@ class User implements IUser { * @since 9.0.0 */ public function setEMailAddress($mailAddress) { + $oldMailAddress = $this->getEMailAddress(); if($mailAddress === '') { $this->config->deleteUserValue($this->uid, 'settings', 'email'); } else { $this->config->setUserValue($this->uid, 'settings', 'email', $mailAddress); } - $this->triggerChange('eMailAddress', $mailAddress); + $this->triggerChange('eMailAddress', $mailAddress, $oldMailAddress); } /** @@ -435,9 +436,9 @@ class User implements IUser { return $url; } - public function triggerChange($feature, $value = null) { + public function triggerChange($feature, $value = null, $oldValue = null) { if ($this->emitter) { - $this->emitter->emit('\OC\User', 'changeUser', array($this, $feature, $value)); + $this->emitter->emit('\OC\User', 'changeUser', array($this, $feature, $value, $oldValue)); } } } |