Skip to content

Commit

Permalink
replace create username logic by set user email to username
Browse files Browse the repository at this point in the history
  • Loading branch information
meofiscoding committed Nov 25, 2023
1 parent 7cec94c commit bde84cf
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions Identity.API/Controllers/AuthController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,15 @@ public async Task<IActionResult> Register([FromBody] RegisterViewModel vm)
});
}

string username = vm.Email.Split('@')[0];
int count = await _userManager.Users
.Where(u => u.Email != null && u.Email.Contains(username))
.CountAsync();
//string username = vm.Email.Split('@')[0];
//int count = await _userManager.Users
// .Where(u => u.Email != null && u.Email.Contains(username))
// .CountAsync();

var user = new ApplicationUser
{
UserName = username + (count > 0 ? count.ToString() : ""),
// UserName = username + (count > 0 ? count.ToString() : ""),
UserName = vm.Email,
Email = vm.Email
};

Expand Down

0 comments on commit bde84cf

Please sign in to comment.