Browse Source
Allow to read the old email on the hook as well
Signed-off-by: Joas Schilling <coding@schilljs.com>
pull/4330/head
Joas Schilling
9 years ago
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
2 changed files with
6 additions and
5 deletions
-
lib/private/Server.php
-
lib/private/User/User.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; |
|
|
|
}); |
|
|
|
|
|
|
|
@ -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)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |