diff --git a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs index 73db088e76..28f5f30684 100644 --- a/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs +++ b/src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs @@ -408,7 +408,9 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers if (ViewData.FromBase64CookieData(_httpContextAccessor.HttpContext, ViewDataExtensions.TokenExternalSignInError, _jsonSerializer) || ViewData.FromTempData(TempData, ViewDataExtensions.TokenExternalSignInError) || ViewData.FromTempData(TempData, ViewDataExtensions.TokenPasswordResetCode)) + { return defaultResponse(); + } //First check if there's external login info, if there's not proceed as normal var loginInfo = await _signInManager.GetExternalLoginInfoAsync(); @@ -442,12 +444,12 @@ namespace Umbraco.Cms.Web.BackOffice.Controllers var errors = new List(); - if (result == Microsoft.AspNetCore.Identity.SignInResult.Success) + if (result == SignInResult.Success) { // Update any authentication tokens if succeeded await _signInManager.UpdateExternalAuthenticationTokensAsync(loginInfo); } - else if (result == Microsoft.AspNetCore.Identity.SignInResult.TwoFactorRequired) + else if (result == SignInResult.TwoFactorRequired) { var attemptedUser = await _userManager.FindByLoginAsync(loginInfo.LoginProvider, loginInfo.ProviderKey); diff --git a/src/Umbraco.Web.Common/Security/UmbracoSignInManager.cs b/src/Umbraco.Web.Common/Security/UmbracoSignInManager.cs index dd52b397d3..80729412a3 100644 --- a/src/Umbraco.Web.Common/Security/UmbracoSignInManager.cs +++ b/src/Umbraco.Web.Common/Security/UmbracoSignInManager.cs @@ -198,6 +198,9 @@ namespace Umbraco.Cms.Web.Common.Security // code taken from aspnetcore: https://github.com/dotnet/aspnetcore/blob/master/src/Identity/Core/src/SignInManager.cs // we also override to set the current HttpContext principal since this isn't done by default + // we also need to call our handle login to ensure all date/events are set + await HandleSignIn(user, user.UserName, SignInResult.Success); + var userPrincipal = await CreateUserPrincipalAsync(user); foreach (var claim in additionalClaims) { @@ -363,7 +366,7 @@ namespace Umbraco.Cms.Web.Common.Security await Context.SignOutAsync(ExternalAuthenticationType); } if (loginProvider == null) - { + { await SignInWithClaimsAsync(user, isPersistent, new Claim[] { new Claim("amr", "pwd") }); } else