]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't create activities for email and password change before login 5521/head
authorJoas Schilling <coding@schilljs.com>
Thu, 22 Jun 2017 07:02:12 +0000 (09:02 +0200)
committerJoas Schilling <coding@schilljs.com>
Fri, 23 Jun 2017 10:27:21 +0000 (12:27 +0200)
Signed-off-by: Joas Schilling <coding@schilljs.com>
settings/Hooks.php

index daf3a40cf1b232714a36e4f3b1cf90c69e880343..2cc5ce30bbe712b3462a7d109cd2466a5345ed9d 100644 (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;
                }