Huge updates
This commit is contained in:
@@ -243,6 +243,16 @@ usersApi.MapPut("/{userId:int}/rename", async (int userId, [FromBody] RenameRequ
|
||||
return Results.Ok();
|
||||
});
|
||||
|
||||
usersApi.MapPut("/{userId:int}/change-password", async (int userId, [FromBody] ChangePasswordRequest req, IAuthService authService) =>
|
||||
{
|
||||
var error = await authService.ChangePasswordAsync(userId, req.CurrentPassword, req.NewPassword);
|
||||
if (error != null)
|
||||
{
|
||||
return Results.BadRequest(error);
|
||||
}
|
||||
return Results.Ok();
|
||||
});
|
||||
|
||||
// ── Timetracker-API-Endpoints (Protected) ─────────────────────────────────────
|
||||
var trackerApi = app.MapGroup("/api/tracker").RequireAuthorization();
|
||||
|
||||
@@ -362,3 +372,4 @@ app.Run();
|
||||
public record LoginRequest(string Username, string Password);
|
||||
public record RegisterRequest(string Username, string Password, string? Honeypot = null);
|
||||
public record RenameRequest(string Username);
|
||||
public record ChangePasswordRequest(string CurrentPassword, string NewPassword);
|
||||
|
||||
Reference in New Issue
Block a user