Add an API endpoint for deleting accounts.

This commit is contained in:
Jon Chambers
2020-09-22 12:47:24 -04:00
committed by Jon Chambers
parent 61f515670c
commit a553eba574
2 changed files with 34 additions and 2 deletions

View File

@@ -482,6 +482,13 @@ public class AccountController {
directoryQueue.refreshRegisteredUser(account);
}
@GET
@Path("/me")
@Produces(MediaType.APPLICATION_JSON)
public AccountCreationResult getMe(@Auth Account account) {
return whoAmI(account);
}
@GET
@Path("/whoami")
@Produces(MediaType.APPLICATION_JSON)
@@ -593,6 +600,13 @@ public class AccountController {
return new CaptchaRequirement(false, false);
}
@Timed
@DELETE
@Path("/me")
public void deleteAccount(@Auth Account account) {
accounts.delete(account);
}
private boolean shouldAutoBlock(String requester) {
try {
rateLimiters.getAutoBlockLimiter().validate(requester);