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;