merge v10 to v11
This commit is contained in:
@@ -36,10 +36,10 @@ public class BackOfficeSecurity : IBackOfficeSecurity
|
||||
// Check again
|
||||
if (_currentUser == null)
|
||||
{
|
||||
Attempt<int?> id = GetUserId();
|
||||
if (id.Success && id.Result is not null)
|
||||
Attempt<int> id = GetUserId();
|
||||
if (id.Success)
|
||||
{
|
||||
_currentUser = id.Success ? _userService.GetUserById(id.Result.Value) : null;
|
||||
_currentUser = id.Success ? _userService.GetUserById(id.Result) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -50,10 +50,12 @@ public class BackOfficeSecurity : IBackOfficeSecurity
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Attempt<int?> GetUserId()
|
||||
public Attempt<int> GetUserId()
|
||||
{
|
||||
ClaimsIdentity? identity = _httpContextAccessor.HttpContext?.GetCurrentIdentity();
|
||||
return identity == null ? Attempt.Fail<int?>() : Attempt.Succeed(identity.GetId());
|
||||
|
||||
var id = identity?.GetId();
|
||||
return id.HasValue is false ? Attempt.Fail<int>() : Attempt.Succeed(id.Value);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -86,7 +86,7 @@ public abstract class UmbracoSignInManager<TUser> : SignInManager<TUser>
|
||||
|
||||
var providerKey = auth.Principal.FindFirstValue(ClaimTypes.NameIdentifier);
|
||||
var provider = items[UmbracoSignInMgrLoginProviderKey];
|
||||
if (providerKey == null || provider is not null)
|
||||
if (providerKey == null || provider == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user