Move number rate-limiting after verification

This commit is contained in:
Ravi Khadiwala authored and Ameya Lokare committed 2026-08-25 13:25:28 -07:00
1 parent 4c2cd0c999
commit a5f2f7f3e5
1 file changed
+2 -2
@@ -226,8 +226,6 @@ public class RegistrationController {
throw new WebApplicationException("PNI keys and registration ID must be provided", 422);
}
rateLimiters.getRegistrationLimiter().validate(number);
final PhoneVerificationRequest.VerificationType verificationType;
try {
verificationType = phoneVerificationTokenManager.verify(
@@ -247,6 +245,8 @@ public class RegistrationController {
throw new ForbiddenException("recovery password could not be verified");
}
rateLimiters.getRegistrationLimiter().validate(number);
// There can be at most one existing account for a set of numbers in the same equivalence class, so it's sufficient
// to find the first one.
final Optional<Account> existingAccount = Util.getAlternateForms(number)