From 39f9b00b45b5d1f783574bade3745a450cbfb4a4 Mon Sep 17 00:00:00 2001 From: Marco Date: Sun, 30 Jul 2017 20:24:19 +0200 Subject: [PATCH] Reflect changed email address in same session immediately --- src/Auth.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Auth.php b/src/Auth.php index 84017ae..3993f24 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -511,6 +511,15 @@ final class Auth extends UserManager { throw new DatabaseError(); } + // if the user is currently signed in + if ($this->isLoggedIn()) { + // if the user has just confirmed an email address for their own account + if ($this->getUserId() === $confirmationData['user_id']) { + // immediately update the email address in the current session as well + $this->setEmail($confirmationData['email']); + } + } + try { $this->db->delete( $this->dbTablePrefix . 'users_confirmations',