Handle 428 for captcha submissions.
This commit is contained in:
parent
e6eefac609
commit
5b10aa6fa7
2 changed files with 20 additions and 1 deletions
|
@ -124,6 +124,7 @@ import org.whispersystems.signalservice.internal.configuration.SignalProxy;
|
|||
import org.whispersystems.signalservice.internal.configuration.SignalServiceConfiguration;
|
||||
import org.whispersystems.signalservice.internal.configuration.SignalUrl;
|
||||
import org.whispersystems.signalservice.internal.crypto.AttachmentDigest;
|
||||
import org.whispersystems.signalservice.internal.push.exceptions.CaptchaRejectedException;
|
||||
import org.whispersystems.signalservice.internal.push.exceptions.DonationProcessorError;
|
||||
import org.whispersystems.signalservice.internal.push.exceptions.DonationReceiptCredentialError;
|
||||
import org.whispersystems.signalservice.internal.push.exceptions.ForbiddenException;
|
||||
|
@ -1247,7 +1248,12 @@ public class PushServiceSocket {
|
|||
|
||||
public void submitRateLimitPushChallenge(String challenge) throws IOException {
|
||||
String payload = JsonUtil.toJson(new SubmitPushChallengePayload(challenge));
|
||||
makeServiceRequest(SUBMIT_RATE_LIMIT_CHALLENGE, "PUT", payload);
|
||||
makeServiceRequest(SUBMIT_RATE_LIMIT_CHALLENGE, "PUT", payload, NO_HEADERS, (responseCode, body) -> {
|
||||
if (responseCode == 428) {
|
||||
throw new CaptchaRejectedException();
|
||||
}
|
||||
}, Optional.empty());
|
||||
|
||||
}
|
||||
|
||||
public void submitRateLimitRecaptchaChallenge(String challenge, String recaptchaToken) throws IOException {
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
/*
|
||||
* Copyright 2024 Signal Messenger, LLC
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
|
||||
package org.whispersystems.signalservice.internal.push.exceptions
|
||||
|
||||
import org.whispersystems.signalservice.api.push.exceptions.NonSuccessfulResponseCodeException
|
||||
|
||||
/**
|
||||
* Indicates that the captcha we submitted was not accepted by the server.
|
||||
*/
|
||||
class CaptchaRejectedException : NonSuccessfulResponseCodeException(428, "Captcha rejected by server.")
|
Loading…
Add table
Reference in a new issue