From fc064dd01c187fbee7ffbe3d02e90e1369a78729 Mon Sep 17 00:00:00 2001 From: Blitblank Date: Sat, 21 Mar 2026 17:26:50 -0500 Subject: [PATCH] add identity to the register endpoint --- api/src/Controllers/AuthController.cs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/src/Controllers/AuthController.cs b/api/src/Controllers/AuthController.cs index ba2ae21..05c4efd 100644 --- a/api/src/Controllers/AuthController.cs +++ b/api/src/Controllers/AuthController.cs @@ -30,15 +30,15 @@ public class AuthController : ControllerBase { var user = new User { UserName = dto.UserName, Email = dto.Email, - PasswordHash = BCrypt.Net.BCrypt.HashPassword(dto.Password), // TODO: secondary hashing stage in client CreatedAt = DateTime.UtcNow // yeah why not utc }; - var newUser = await users_.Create(user); + var result = await userManager_.CreateAsync(user, dto.Password); + if(!result.Succeeded) return BadRequest(result.Errors); + return CreatedAtAction( nameof(Register), - new { id = newUser.Id }, - user + new { id = user.Id } ); } @@ -63,6 +63,7 @@ public class AuthController : ControllerBase { public ActionResult Logout() { // dummy endpoint // logout happens upon client-side jwt removal + // TODO: expire all refresh tokens return Ok(); } @@ -70,4 +71,5 @@ public class AuthController : ControllerBase { // refresh tokens // email verification // password reset + // oh hell naw 2FA I do not care enough } \ No newline at end of file