Skip to content

Commit a427bc1

Browse files
committed
check if password is hashed on register by api
1 parent a75c075 commit a427bc1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Intersect.Server/Web/RestApi/Routes/V1/UserController.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ public IActionResult RegisterUser([FromBody] UserInfoRequestBody user)
9999
return BadRequest($@"Invalid username '{user.Username}'.");
100100
}
101101

102+
if (!Regex.IsMatch(user.Password?.ToUpperInvariant()?.Trim(), "^[0-9A-Fa-f]{64}$", RegexOptions.Compiled))
103+
{
104+
return BadRequest(@"Did not receive a valid password.");
105+
}
106+
102107
if (Database.PlayerData.User.UserExists(user.Username))
103108
{
104109
return BadRequest($@"Account already exists with username '{user.Username}'.");

0 commit comments

Comments
 (0)