Skip to content

Commit 5ce7de5

Browse files
Fix sms body quoting
Co-authored-by: Jon Chambers <jon@signal.org>
1 parent ee6532c commit 5ce7de5

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/main/resources/org/signal/registration/sender/sms.properties

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
# smartling.placeholder_format_custom=\{([^}]+)\}
77

8-
verification.sms.ios=SIGNAL code: {code}. Do not share this code with anyone. If anyone asks it's a SCAM. Our reps will NEVER ask for it.
9-
verification.sms.android=SIGNAL code: {code}. Do not share this code with anyone. If anyone asks it's a SCAM. Our reps will NEVER ask for it.\n\n{appHash}
10-
verification.sms.generic=SIGNAL code: {code}. Do not share this code with anyone. If anyone asks it's a SCAM. Our reps will NEVER ask for it.
8+
verification.sms.ios=SIGNAL code: {code}. Do not share this code with anyone. If anyone asks it''s a SCAM. Our reps will NEVER ask for it.
9+
verification.sms.android=SIGNAL code: {code}. Do not share this code with anyone. If anyone asks it''s a SCAM. Our reps will NEVER ask for it.\n\n{appHash}
10+
verification.sms.generic=SIGNAL code: {code}. Do not share this code with anyone. If anyone asks it''s a SCAM. Our reps will NEVER ask for it.
1111

1212
verification.sms.ios.short=Register with {code}
1313
verification.sms.android.short=Register with {code}

src/test/java/org/signal/registration/sender/VerificationSmsBodyProviderTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import java.util.Map;
2525
import java.util.Optional;
2626
import java.util.stream.Stream;
27+
import org.apache.commons.lang3.RandomStringUtils;
2728
import org.junit.jupiter.api.BeforeEach;
2829
import org.junit.jupiter.api.Test;
2930
import org.junit.jupiter.params.ParameterizedTest;
@@ -34,13 +35,15 @@ class VerificationSmsBodyProviderTest {
3435

3536
private VerificationSmsConfiguration configuration;
3637

38+
private static final String ANDROID_APP_HASH = RandomStringUtils.insecure().nextAlphanumeric(11);
39+
3740
private static final Phonenumber.PhoneNumber US_NUMBER = PhoneNumberUtil.getInstance().getExampleNumber("US");
3841
private static final Phonenumber.PhoneNumber CN_NUMBER = PhoneNumberUtil.getInstance().getExampleNumber("CN");
3942

4043
@BeforeEach
4144
void setUp() {
4245
configuration = new VerificationSmsConfiguration();
43-
configuration.setAndroidAppHash("app-hash");
46+
configuration.setAndroidAppHash(ANDROID_APP_HASH);
4447
configuration.setSupportedLanguages(List.of("en"));
4548
}
4649

@@ -54,6 +57,10 @@ void getMessageBody(final Phonenumber.PhoneNumber phoneNumber, final ClientType
5457
assertDoesNotThrow(() -> bodyProvider.getVerificationBody(phoneNumber, clientType, verificationCode, languageRanges));
5558

5659
assertTrue(messageBody.contains(verificationCode));
60+
61+
if (clientType == ClientType.ANDROID_WITH_FCM) {
62+
assertTrue(messageBody.contains(ANDROID_APP_HASH));
63+
}
5764
}
5865

5966
private static Stream<Arguments> getMessageBody() {

0 commit comments

Comments
 (0)