Change identity password on changing account password for same tld

pull/162/head
M66B 5 years ago
parent 72214f2884
commit c89dd5a979

@ -930,6 +930,17 @@ public class FragmentAccount extends FragmentBase {
try {
db.beginTransaction();
if (account != null && !account.password.equals(password)) {
List<EntityIdentity> identities = db.identity().getIdentities(account.id);
for (EntityIdentity identity : identities)
if (identity.password.equals(account.password) &&
Helper.getTld(identity.host).equals(Helper.getTld(account.host))) {
Log.i("Changing identity password host=" + identity.host);
identity.password = password;
db.identity().updateIdentity(identity);
}
}
boolean update = (account != null);
if (account == null)
account = new EntityAccount();

@ -871,6 +871,14 @@ public class Helper {
return true;
}
static String getTld(String host) {
String[] h = host.split("\\.");
if (h.length >= 2)
return h[h.length - 2] + "." + h[h.length - 1];
else
return host;
}
static int getSize(Bundle bundle) {
Parcel p = Parcel.obtain();
bundle.writeToParcel(p, 0);

Loading…
Cancel
Save