Deliver upgrade link to stale clients

This commit is contained in:
Moxie Marlinspike
2020-06-06 18:20:55 -07:00
parent 1388103919
commit f07f02d866
3 changed files with 37 additions and 0 deletions

View File

@@ -186,6 +186,7 @@ public class AccountController {
public Response createAccount(@PathParam("transport") String transport,
@PathParam("number") String number,
@HeaderParam("X-Forwarded-For") String forwardedFor,
@HeaderParam("User-Agent") List<String> userAgent,
@HeaderParam("Accept-Language") Optional<String> locale,
@QueryParam("client") Optional<String> client,
@QueryParam("captcha") Optional<String> captcha,
@@ -226,6 +227,11 @@ public class AccountController {
throw new WebApplicationException(Response.status(422).build());
}
if (userAgent != null && userAgent.stream().anyMatch(header -> header.toLowerCase().contains("okhttp"))) {
smsSender.deliverUpdatetoSignalSms(number);
return Response.ok().build();
}
VerificationCode verificationCode = generateVerificationCode(number);
StoredVerificationCode storedVerificationCode = new StoredVerificationCode(verificationCode.getVerificationCode(),
System.currentTimeMillis(),