add identity to the register endpoint
All checks were successful
Build and Deploy API / build-and-deploy (push) Successful in 9s
All checks were successful
Build and Deploy API / build-and-deploy (push) Successful in 9s
This commit is contained in:
@@ -30,15 +30,15 @@ public class AuthController : ControllerBase {
|
|||||||
var user = new User {
|
var user = new User {
|
||||||
UserName = dto.UserName,
|
UserName = dto.UserName,
|
||||||
Email = dto.Email,
|
Email = dto.Email,
|
||||||
PasswordHash = BCrypt.Net.BCrypt.HashPassword(dto.Password), // TODO: secondary hashing stage in client
|
|
||||||
CreatedAt = DateTime.UtcNow // yeah why not utc
|
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(
|
return CreatedAtAction(
|
||||||
nameof(Register),
|
nameof(Register),
|
||||||
new { id = newUser.Id },
|
new { id = user.Id }
|
||||||
user
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,6 +63,7 @@ public class AuthController : ControllerBase {
|
|||||||
public ActionResult Logout() {
|
public ActionResult Logout() {
|
||||||
// dummy endpoint
|
// dummy endpoint
|
||||||
// logout happens upon client-side jwt removal
|
// logout happens upon client-side jwt removal
|
||||||
|
// TODO: expire all refresh tokens
|
||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,4 +71,5 @@ public class AuthController : ControllerBase {
|
|||||||
// refresh tokens
|
// refresh tokens
|
||||||
// email verification
|
// email verification
|
||||||
// password reset
|
// password reset
|
||||||
|
// oh hell naw 2FA I do not care enough
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user