Don't create activities for email and password change before login

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2017-06-22 09:02:12 +02:00
parent 70afe8d03b
commit 7e714ae971
No known key found for this signature in database
GPG Key ID: E166FD8976B3BAC8
1 changed files with 6 additions and 3 deletions

View File

@ -78,7 +78,8 @@ class Hooks {
public function onChangePassword($uid) {
$user = $this->userManager->get($uid);
if (!$user instanceof IUser || $user->getEMailAddress() === null) {
if (!$user instanceof IUser || $user->getLastLogin() === 0) {
// User didn't login, so don't create activities and emails.
return;
}
@ -141,8 +142,10 @@ class Hooks {
*/
public function onChangeEmail(IUser $user, $oldMailAddress) {
if ($oldMailAddress === $user->getEMailAddress()) {
// Email didn't really change, so don't create activities and emails
if ($oldMailAddress === $user->getEMailAddress() ||
$user->getLastLogin() === 0) {
// Email didn't really change or user didn't login,
// so don't create activities and emails.
return;
}