[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]
|
[HideRequestDuration]
|
||||||
[EnableRateLimiting("strict")]
|
[EnableRateLimiting("strict")]
|
||||||
[Consumes(MediaTypeNames.Application.Json)]
|
[Consumes(MediaTypeNames.Application.Json)]
|
||||||
|
@ -82,7 +82,7 @@ public class AuthController(DatabaseContext db, UserService userSvc, UserRendere
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPut]
|
[HttpPost("register")]
|
||||||
[EnableRateLimiting("strict")]
|
[EnableRateLimiting("strict")]
|
||||||
[Consumes(MediaTypeNames.Application.Json)]
|
[Consumes(MediaTypeNames.Application.Json)]
|
||||||
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(AuthResponse))]
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(AuthResponse))]
|
||||||
|
@ -97,7 +97,7 @@ public class AuthController(DatabaseContext db, UserService userSvc, UserRendere
|
||||||
return await Login(request);
|
return await Login(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPatch]
|
[HttpPost("change-password")]
|
||||||
[Authenticate]
|
[Authenticate]
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[EnableRateLimiting("strict")]
|
[EnableRateLimiting("strict")]
|
||||||
|
|
|
@ -9,11 +9,11 @@ internal class AuthControllerModel(ApiClient api)
|
||||||
api.Call<AuthResponse>(HttpMethod.Get, "/auth");
|
api.Call<AuthResponse>(HttpMethod.Get, "/auth");
|
||||||
|
|
||||||
public Task<AuthResponse> Login(AuthRequest request) =>
|
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) =>
|
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) =>
|
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