Skip to content

Commit

Permalink
Fix code scanning alert
Browse files Browse the repository at this point in the history
Exposure of private information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
1 parent e4b54e8 commit a87fbc7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/WebApp/Pages/Account/ExternalLogin.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,25 +165,24 @@ private async Task<IActionResult> CreateUserAndSignInAsync(ExternalLoginInfo inf
var createUserResult = await userManager.CreateAsync(user);
if (!createUserResult.Succeeded)
{
logger.LogWarning("Failed to create new user {UserName}", user.Email.MaskEmail());
logger.LogWarning("Failed to create new user with object ID {ObjectId}", user.ObjectIdentifier);
return await FailedLoginAsync(createUserResult, user);
}

logger.LogInformation("Created new user {Email} with object ID {ObjectId}",
user.Email.MaskEmail(), user.ObjectIdentifier);
logger.LogInformation("Created new user with object ID {ObjectId}", user.ObjectIdentifier);

// Add new user to application Roles if seeded in app settings or local admin user setting is enabled.
var seedAdminUsers = configuration.GetSection("SeedAdminUsers").Get<string[]>();
if (AppSettings.DevSettings.LocalUserIsStaff)
{
logger.LogInformation("Seeding staff role for new user {Email}", user.Email.MaskEmail());
logger.LogInformation("Seeding staff role for new user with object ID {ObjectId}", user.ObjectIdentifier);
await userManager.AddToRoleAsync(user, RoleName.Staff);
}

if (AppSettings.DevSettings.LocalUserIsAdmin ||
(seedAdminUsers != null && seedAdminUsers.Contains(user.Email, StringComparer.InvariantCultureIgnoreCase)))
{
logger.LogInformation("Seeding all roles for new user {Email}", user.Email.MaskEmail());
logger.LogInformation("Seeding all roles for new user with object ID {ObjectId}", user.ObjectIdentifier);
foreach (var role in AppRole.AllRoles) await userManager.AddToRoleAsync(user, role.Key);
}

Expand Down

0 comments on commit a87fbc7

Please sign in to comment.