mirror of https://github.com/M66B/FairEmail.git
Change identity password on changing account password for same tld
This commit is contained in:
parent
72214f2884
commit
c89dd5a979
|
@ -930,6 +930,17 @@ public class FragmentAccount extends FragmentBase {
|
||||||
try {
|
try {
|
||||||
db.beginTransaction();
|
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);
|
boolean update = (account != null);
|
||||||
if (account == null)
|
if (account == null)
|
||||||
account = new EntityAccount();
|
account = new EntityAccount();
|
||||||
|
|
|
@ -871,6 +871,14 @@ public class Helper {
|
||||||
return true;
|
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) {
|
static int getSize(Bundle bundle) {
|
||||||
Parcel p = Parcel.obtain();
|
Parcel p = Parcel.obtain();
|
||||||
bundle.writeToParcel(p, 0);
|
bundle.writeToParcel(p, 0);
|
||||||
|
|
Loading…
Reference in New Issue