Keep username hash during reregistration

This commit is contained in:
Katherine Yen
2023-02-21 09:07:30 -08:00
committed by GitHub
parent b59b8621c5
commit 11c93c5f53
2 changed files with 46 additions and 36 deletions

View File

@@ -195,6 +195,9 @@ public class Accounts extends AbstractDynamoDbStore {
account.setUuid(UUIDUtil.fromByteBuffer(actualAccountUuid));
final Account existingAccount = getByAccountIdentifier(account.getUuid()).orElseThrow();
// It's up to the client to delete this username hash if they can't retrieve and decrypt the plaintext username from storage service
existingAccount.getUsernameHash().ifPresent(existingUsernameHash -> account.setUsernameHash(existingUsernameHash));
account.setNumber(existingAccount.getNumber(), existingAccount.getPhoneNumberIdentifier());
account.setVersion(existingAccount.getVersion());