Update Option.RECAPTCHA to Option.CAPTCHA

This commit is contained in:
Chris Eager 2024-03-14 09:52:26 -05:00 committed by Cody Henthorne
parent 8f884fdd5c
commit 0c6761fcfd
3 changed files with 11 additions and 4 deletions

View file

@ -594,8 +594,13 @@ public abstract class PushSendJob extends SendJob {
SignalDatabase.messages().markAsRateLimited(messageId);
}
if (proofRequired.getOptions().contains(ProofRequiredException.Option.RECAPTCHA)) {
Log.i(TAG, "[Proof Required] ReCAPTCHA required.");
final Optional<ProofRequiredException.Option> captchaRequired =
proofRequired.getOptions().stream()
.filter(option -> option.equals(ProofRequiredException.Option.RECAPTCHA) || option.equals(ProofRequiredException.Option.CAPTCHA))
.findFirst();
if (captchaRequired.isPresent()) {
Log.i(TAG, "[Proof Required] " + captchaRequired.get() + " required.");
SignalStore.rateLimit().markNeedsRecaptcha(proofRequired.getToken());
if (recipient != null) {

View file

@ -44,6 +44,8 @@ public class ProofRequiredException extends NonSuccessfulResponseCodeException {
switch (raw) {
case "recaptcha":
options.add(Option.RECAPTCHA);
case "captcha":
options.add(Option.CAPTCHA);
break;
case "pushChallenge":
options.add(Option.PUSH_CHALLENGE);
@ -58,6 +60,6 @@ public class ProofRequiredException extends NonSuccessfulResponseCodeException {
}
public enum Option {
RECAPTCHA, PUSH_CHALLENGE
@Deprecated RECAPTCHA, CAPTCHA, PUSH_CHALLENGE
}
}

View file

@ -16,7 +16,7 @@ class SubmitRecaptchaChallengePayload {
public SubmitRecaptchaChallengePayload() {}
public SubmitRecaptchaChallengePayload(String challenge, String recaptchaToken) {
this.type = "recaptcha";
this.type = "captcha";
this.token = challenge;
this.captcha = recaptchaToken;
}