Skip to content

Commit 6bf03d0

Browse files
committed
Fixed a bug with current user access checks
1 parent 54c74bb commit 6bf03d0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Exceptionless.Web/Controllers/AuthController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ public async Task<IActionResult> IsEmailAddressAvailableAsync(string email)
477477
return StatusCode(StatusCodes.Status204NoContent);
478478

479479
email = email.Trim().ToLowerInvariant();
480-
if (String.Equals(CurrentUser.EmailAddress, email, StringComparison.InvariantCultureIgnoreCase))
480+
if (User.IsUserAuthType() && String.Equals(CurrentUser.EmailAddress, email, StringComparison.InvariantCultureIgnoreCase))
481481
return StatusCode(StatusCodes.Status201Created);
482482

483483
// Only allow 3 checks attempts per hour period by a single ip.
@@ -631,7 +631,7 @@ private async Task AddGlobalAdminRoleIfFirstUserAsync(User user)
631631

632632
private async Task<ActionResult<TokenResult>> ExternalLoginAsync<TClient>(ExternalAuthInfo authInfo, string? appId, string? appSecret, Func<IRequestFactory, IClientConfiguration, TClient> createClient) where TClient : OAuth2Client
633633
{
634-
using var _ = _logger.BeginScope(new ExceptionlessState().Tag("External Login").Identity(CurrentUser.EmailAddress).Property("User", CurrentUser).SetHttpContext(HttpContext));
634+
using var _ = _logger.BeginScope(new ExceptionlessState().Tag("External Login").SetHttpContext(HttpContext));
635635
if (String.IsNullOrEmpty(appId) || String.IsNullOrEmpty(appSecret))
636636
throw new ConfigurationErrorsException("Missing Configuration for OAuth provider");
637637

@@ -679,7 +679,7 @@ private async Task<ActionResult<TokenResult>> ExternalLoginAsync<TClient>(Extern
679679
private async Task<User> FromExternalLoginAsync(UserInfo userInfo)
680680
{
681681
var existingUser = await _userRepository.GetUserByOAuthProviderAsync(userInfo.ProviderName, userInfo.Id);
682-
using var _ = _logger.BeginScope(new ExceptionlessState().Tag("External Login").Identity(CurrentUser.EmailAddress).Property("User Info", userInfo).Property("User", CurrentUser).Property("ExistingUser", existingUser).SetHttpContext(HttpContext));
682+
using var _ = _logger.BeginScope(new ExceptionlessState().Tag("External Login").Property("User Info", userInfo).Property("ExistingUser", existingUser).SetHttpContext(HttpContext));
683683

684684
// Link user accounts.
685685
if (User.IsUserAuthType())

0 commit comments

Comments
 (0)