From c6176a0ae700d9075fbf9088b18d29f133ba1df5 Mon Sep 17 00:00:00 2001 From: Andy Butland Date: Mon, 15 Nov 2021 11:42:04 +0100 Subject: [PATCH] Added null check for external login invocation when linking users. --- .../Security/BackOfficeSignInManager.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs b/src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs index 4426e07e22e1..e32a556c1bcd 100644 --- a/src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs +++ b/src/Umbraco.Web.BackOffice/Security/BackOfficeSignInManager.cs @@ -193,8 +193,8 @@ private async Task AutoLinkAndSignInExternalAccount(ExternalLoginI return AutoLinkSignInResult.FailedException(ex.Message); } - var shouldSignIn = autoLinkOptions.OnExternalLogin(autoLinkUser, loginInfo); - if (shouldSignIn == false) + var shouldLinkUser = autoLinkOptions.OnExternalLogin == null || autoLinkOptions.OnExternalLogin(autoLinkUser, loginInfo); + if (shouldLinkUser == false) { LogFailedExternalLogin(loginInfo, autoLinkUser); return ExternalLoginSignInResult.NotAllowed; @@ -235,8 +235,8 @@ private async Task AutoLinkAndSignInExternalAccount(ExternalLoginI } else { - var shouldSignIn = autoLinkOptions.OnExternalLogin(autoLinkUser, loginInfo); - if (shouldSignIn == false) + var shouldLinkUser = autoLinkOptions.OnExternalLogin == null || autoLinkOptions.OnExternalLogin(autoLinkUser, loginInfo); + if (shouldLinkUser == false) { LogFailedExternalLogin(loginInfo, autoLinkUser); return ExternalLoginSignInResult.NotAllowed;