Don't allow callers to unlink their primary device

This commit is contained in:
Jon Chambers 2023-09-09 19:06:07 -04:00 committed by Jon Chambers
parent 845fc338d7
commit 2b764c2abd
1 changed files with 4 additions and 0 deletions

View File

@ -141,6 +141,10 @@ public class DeviceController {
throw new WebApplicationException(Response.Status.UNAUTHORIZED);
}
if (deviceId == Device.MASTER_ID) {
throw new ForbiddenException();
}
final CompletableFuture<Void> deleteKeysFuture = keys.delete(account.getUuid(), deviceId);
messages.clear(account.getUuid(), deviceId).join();