Fix for inactive auth problem

This commit is contained in:
Moxie Marlinspike 2019-01-24 17:48:04 -08:00
parent f630ccb134
commit e201344ccd
2 changed files with 6 additions and 2 deletions

View File

@ -66,7 +66,7 @@ public class AccountAuthenticator implements Authenticator<BasicCredentials, Acc
return Optional.empty(); return Optional.empty();
} }
if (!device.get().isMaster() && !device.get().isActive()) { if (!device.get().isMaster() && device.get().isIdleInactive()) {
return Optional.empty(); return Optional.empty();
} }

View File

@ -195,7 +195,11 @@ public class Device {
boolean hasChannel = fetchesMessages || !Util.isEmpty(getApnId()) || !Util.isEmpty(getGcmId()); boolean hasChannel = fetchesMessages || !Util.isEmpty(getApnId()) || !Util.isEmpty(getGcmId());
return (id == MASTER_ID && hasChannel && signedPreKey != null) || return (id == MASTER_ID && hasChannel && signedPreKey != null) ||
(id != MASTER_ID && hasChannel && signedPreKey != null && lastSeen > (System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30))); (id != MASTER_ID && hasChannel && signedPreKey != null && !isIdleInactive());
}
public boolean isIdleInactive() {
return id != MASTER_ID && lastSeen < (System.currentTimeMillis() - TimeUnit.DAYS.toMillis(30));
} }
public boolean getFetchesMessages() { public boolean getFetchesMessages() {