mirror of https://github.com/M66B/FairEmail.git
Improved password update
This commit is contained in:
parent
9788fb9572
commit
a5bea023b5
|
@ -375,7 +375,7 @@ public class ConnectionHelper {
|
|||
return null;
|
||||
}
|
||||
|
||||
static String getDomain(String host) {
|
||||
static String getParentDomain(String host) {
|
||||
if (host != null) {
|
||||
String[] h = host.split("\\.");
|
||||
if (h.length >= 2)
|
||||
|
|
|
@ -987,10 +987,10 @@ public class FragmentAccount extends FragmentBase {
|
|||
db.beginTransaction();
|
||||
|
||||
if (account != null && !account.password.equals(password)) {
|
||||
String match = "%" + ConnectionHelper.getDomain(account.host);
|
||||
int count = db.identity().setIdentityPassword(
|
||||
account.id, account.user, password, match);
|
||||
Log.i("Updated passwords=" + count);
|
||||
String domain = ConnectionHelper.getParentDomain(account.host);
|
||||
String match = (Objects.equals(account.host, domain) ? account.host : "%." + domain);
|
||||
int count = db.identity().setIdentityPassword(account.id, account.user, password, match);
|
||||
Log.i("Updated passwords=" + count + " match=" + match);
|
||||
}
|
||||
|
||||
boolean update = (account != null);
|
||||
|
|
|
@ -50,6 +50,7 @@ import com.google.android.material.snackbar.Snackbar;
|
|||
import com.google.android.material.textfield.TextInputLayout;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.Objects;
|
||||
|
||||
import static android.app.Activity.RESULT_OK;
|
||||
|
||||
|
@ -286,11 +287,10 @@ public class FragmentPop extends FragmentBase {
|
|||
db.beginTransaction();
|
||||
|
||||
if (account != null && !account.password.equals(password)) {
|
||||
int count = db.identity().setIdentityPassword(
|
||||
account.id,
|
||||
account.user, password,
|
||||
"%." + ConnectionHelper.getDomain(account.host));
|
||||
Log.i("Updated passwords=" + count);
|
||||
String domain = ConnectionHelper.getParentDomain(account.host);
|
||||
String match = (Objects.equals(account.host, domain) ? account.host : "%." + domain);
|
||||
int count = db.identity().setIdentityPassword(account.id, account.user, password, match);
|
||||
Log.i("Updated passwords=" + count + " match=" + match);
|
||||
}
|
||||
|
||||
boolean update = (account != null);
|
||||
|
|
Loading…
Reference in New Issue