Skip to content

Commit

Permalink
Add root user
Browse files Browse the repository at this point in the history
  • Loading branch information
panosru committed Feb 20, 2024
1 parent 1231a8e commit dbd9d01
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Domains/Account/CrossCutting/AccountCrossCutting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,13 @@ await PopulateDefaultAccountRolesAsync(serviceProvider)
// Create default user data
CreateAccountDto accountDto = new()
{
UserName = "admin",
Email = "admin@localhost.com",
FirstName = "Panagiotis",
LastName = "Kosmidis",
Password = "Administrator1!"
};

if (userManager.Users.All(u => u.UserName != accountDto.UserName))
if (userManager.Users.All(u => u.UserName != accountDto.Email))
{
var orchestrator =
serviceProvider.GetRequiredService<IOrchestrator<AccountAggregate, AccountAggregateId>>();
Expand All @@ -67,7 +66,6 @@ await PopulateDefaultAccountRolesAsync(serviceProvider)
OrchestratorResponse requestResult = await orchestrator
.SendCommandAsync(
new CreateAccountCommand(
accountDto.UserName,
accountDto.Password,
accountDto.FirstName,
accountDto.LastName,
Expand All @@ -77,7 +75,7 @@ await PopulateDefaultAccountRolesAsync(serviceProvider)
.ConfigureAwait(false);

if (!requestResult.Succeeded)
throw new NotSupportedException($"Unable to create default user \"{accountDto.UserName}\".");
throw new NotSupportedException($"Unable to create default user \"{accountDto.Email}\".");
}
}

Expand Down

0 comments on commit dbd9d01

Please sign in to comment.