[backend/api] Make auth endpoints RESTful
This commit is contained in:
parent
86c0ab02b5
commit
e4814804c0
2 changed files with 6 additions and 6 deletions
|
@ -38,7 +38,7 @@ public class AuthController(DatabaseContext db, UserService userSvc, UserRendere
|
|||
});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
[HttpPost("login")]
|
||||
[HideRequestDuration]
|
||||
[EnableRateLimiting("strict")]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
|
@ -82,7 +82,7 @@ public class AuthController(DatabaseContext db, UserService userSvc, UserRendere
|
|||
});
|
||||
}
|
||||
|
||||
[HttpPut]
|
||||
[HttpPost("register")]
|
||||
[EnableRateLimiting("strict")]
|
||||
[Consumes(MediaTypeNames.Application.Json)]
|
||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(AuthResponse))]
|
||||
|
@ -97,7 +97,7 @@ public class AuthController(DatabaseContext db, UserService userSvc, UserRendere
|
|||
return await Login(request);
|
||||
}
|
||||
|
||||
[HttpPatch]
|
||||
[HttpPost("change-password")]
|
||||
[Authenticate]
|
||||
[Authorize]
|
||||
[EnableRateLimiting("strict")]
|
||||
|
|
|
@ -9,11 +9,11 @@ internal class AuthControllerModel(ApiClient api)
|
|||
api.Call<AuthResponse>(HttpMethod.Get, "/auth");
|
||||
|
||||
public Task<AuthResponse> Login(AuthRequest request) =>
|
||||
api.Call<AuthResponse>(HttpMethod.Post, "/auth", data: request);
|
||||
api.Call<AuthResponse>(HttpMethod.Post, "/auth/login", data: request);
|
||||
|
||||
public Task<AuthResponse> Register(RegistrationRequest request) =>
|
||||
api.Call<AuthResponse>(HttpMethod.Put, "/auth", data: request);
|
||||
api.Call<AuthResponse>(HttpMethod.Post, "/auth/register", data: request);
|
||||
|
||||
public Task<AuthResponse> ChangePassword(ChangePasswordRequest request) =>
|
||||
api.Call<AuthResponse>(HttpMethod.Patch, "/auth", data: request);
|
||||
api.Call<AuthResponse>(HttpMethod.Post, "/auth/change-password", data: request);
|
||||
}
|
Loading…
Add table
Reference in a new issue