Use `setRegistrationLockFromAttributes`
This commit is contained in:
parent
6a654ab90b
commit
5358fc4f43
|
@ -359,7 +359,7 @@ public class AccountController {
|
||||||
storedVerificationCode.flatMap(StoredVerificationCode::getTwilioVerificationSid)
|
storedVerificationCode.flatMap(StoredVerificationCode::getTwilioVerificationSid)
|
||||||
.ifPresent(smsSender::reportVerificationSucceeded);
|
.ifPresent(smsSender::reportVerificationSucceeded);
|
||||||
|
|
||||||
Optional<Account> existingAccount = accounts.getByE164(number);
|
Optional<Account> existingAccount = accounts.getByE164(number);
|
||||||
|
|
||||||
if (existingAccount.isPresent()) {
|
if (existingAccount.isPresent()) {
|
||||||
verifyRegistrationLock(existingAccount.get(), accountAttributes.getRegistrationLock());
|
verifyRegistrationLock(existingAccount.get(), accountAttributes.getRegistrationLock());
|
||||||
|
@ -571,11 +571,6 @@ public class AccountController {
|
||||||
Account account = disabledPermittedAuth.getAccount();
|
Account account = disabledPermittedAuth.getAccount();
|
||||||
long deviceId = disabledPermittedAuth.getAuthenticatedDevice().getId();
|
long deviceId = disabledPermittedAuth.getAuthenticatedDevice().getId();
|
||||||
|
|
||||||
// temporary: For deterministic updates during the DynamoDB migration, use a fully parameterized registration lock
|
|
||||||
@Nullable final AuthenticationCredentials registrationLockCredentials =
|
|
||||||
Util.isEmpty(attributes.getRegistrationLock()) ? null
|
|
||||||
: new AuthenticationCredentials(attributes.getRegistrationLock());
|
|
||||||
|
|
||||||
accounts.update(account, a -> {
|
accounts.update(account, a -> {
|
||||||
a.getDevice(deviceId).ifPresent(d -> {
|
a.getDevice(deviceId).ifPresent(d -> {
|
||||||
d.setFetchesMessages(attributes.getFetchesMessages());
|
d.setFetchesMessages(attributes.getFetchesMessages());
|
||||||
|
@ -586,15 +581,7 @@ public class AccountController {
|
||||||
d.setUserAgent(userAgent);
|
d.setUserAgent(userAgent);
|
||||||
});
|
});
|
||||||
|
|
||||||
// temporary: for deterministic updates during the DynamoDB migration, use a fully parameterized registration lock
|
a.setRegistrationLockFromAttributes(attributes);
|
||||||
// a.setRegistrationLockFromAttributes(attributes);
|
|
||||||
if (registrationLockCredentials != null) {
|
|
||||||
a.setRegistrationLock(registrationLockCredentials.getHashedAuthenticationToken(),
|
|
||||||
registrationLockCredentials.getSalt());
|
|
||||||
} else {
|
|
||||||
a.setRegistrationLock(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
a.setUnidentifiedAccessKey(attributes.getUnidentifiedAccessKey());
|
a.setUnidentifiedAccessKey(attributes.getUnidentifiedAccessKey());
|
||||||
a.setUnrestrictedUnidentifiedAccess(attributes.isUnrestrictedUnidentifiedAccess());
|
a.setUnrestrictedUnidentifiedAccess(attributes.isUnrestrictedUnidentifiedAccess());
|
||||||
a.setDiscoverableByPhoneNumber(attributes.isDiscoverableByPhoneNumber());
|
a.setDiscoverableByPhoneNumber(attributes.isDiscoverableByPhoneNumber());
|
||||||
|
|
Loading…
Reference in New Issue