From 5fa0e6df39f7e9df5a9f59b5d8b2c4b507975d41 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle <bjoern@schiessle.org> Date: Wed, 26 Apr 2017 15:20:41 +0200 Subject: [PATCH] fix email verification status Signed-off-by: Bjoern Schiessle <bjoern@schiessle.org> --- lib/private/Accounts/AccountManager.php | 6 +++++- tests/lib/Accounts/AccountsManagerTest.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/private/Accounts/AccountManager.php b/lib/private/Accounts/AccountManager.php index bd23f6289c0..41fdad148aa 100644 --- a/lib/private/Accounts/AccountManager.php +++ b/lib/private/Accounts/AccountManager.php @@ -97,7 +97,7 @@ class AccountManager { if (empty($userData)) { $this->insertNewUser($user, $data); } elseif ($userData !== $data) { - $this->checkEmailVerification($userData, $data, $user); + $data = $this->checkEmailVerification($userData, $data, $user); $data = $this->updateVerifyStatus($userData, $data); $this->updateExistingUser($user, $data); } else { @@ -147,6 +147,7 @@ class AccountManager { * @param $oldData * @param $newData * @param IUser $user + * @return array */ protected function checkEmailVerification($oldData, $newData, IUser $user) { if ($oldData[self::PROPERTY_EMAIL]['value'] !== $newData[self::PROPERTY_EMAIL]['value']) { @@ -160,7 +161,10 @@ class AccountManager { 'lastRun' => time() ] ); + $newData[AccountManager::PROPERTY_EMAIL]['verified'] = AccountManager::VERIFICATION_IN_PROGRESS; } + + return $newData; } /** diff --git a/tests/lib/Accounts/AccountsManagerTest.php b/tests/lib/Accounts/AccountsManagerTest.php index 90b4c4b9f67..6cefebdea86 100644 --- a/tests/lib/Accounts/AccountsManagerTest.php +++ b/tests/lib/Accounts/AccountsManagerTest.php @@ -95,7 +95,7 @@ class AccountsManagerTest extends TestCase { if ($updateExisting) { $accountManager->expects($this->once())->method('checkEmailVerification') - ->with($oldData, $newData, $user); + ->with($oldData, $newData, $user)->willReturn($newData); $accountManager->expects($this->once())->method('updateVerifyStatus') ->with($oldData, $newData)->willReturn($newData); $accountManager->expects($this->once())->method('updateExistingUser') -- GitLab