From 740bf3ee287710e837842e1eb1c467833fbcc400 Mon Sep 17 00:00:00 2001 From: Charles Verge Date: Thu, 29 Oct 2015 11:19:23 -0300 Subject: [PATCH] MSFTMPP-268: Check if OIDC user is already migrated --- classes/loginflow/authcode.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/loginflow/authcode.php b/classes/loginflow/authcode.php index 516c9b4..0d14cd1 100644 --- a/classes/loginflow/authcode.php +++ b/classes/loginflow/authcode.php @@ -157,7 +157,9 @@ class authcode extends \auth_oidc\loginflow\base { return true; } - if (isloggedin() === true) { + // Check if OIDC user is already migrated. + $tokenrec = $DB->get_record('auth_oidc_token', ['oidcuniqid' => $oidcuniqid]); + if (isloggedin() === true && empty($tokenrec)) { // If the user is already logged in we can treat this as a "migration" - a user switching to OIDC. $connectiononly = false; if (isset($SESSION->auth_oidc_connectiononly)) { @@ -309,4 +311,4 @@ class authcode extends \auth_oidc\loginflow\base { complete_user_login($user); return true; } -} \ No newline at end of file +}