Fixed #165 - Login and Registration will allow case-insensitive usernames now. (#169)

This commit is contained in:
Joseph Milazzo 2021-04-11 18:08:56 -05:00 committed by GitHub
parent 32bd5d6ee6
commit 9e5bcb8501
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,7 +82,7 @@ namespace API.Controllers
[HttpPost("register")]
public async Task<ActionResult<UserDto>> Register(RegisterDto registerDto)
{
if (await _userManager.Users.AnyAsync(x => x.UserName == registerDto.Username))
if (await _userManager.Users.AnyAsync(x => x.NormalizedUserName == registerDto.Username.ToUpper()))
{
return BadRequest("Username is taken.");
}