|
|
@ -108,6 +108,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
private EditText etUser;
|
|
|
|
private EditText etUser;
|
|
|
|
private TextInputLayout tilPassword;
|
|
|
|
private TextInputLayout tilPassword;
|
|
|
|
private TextView tvPasswordStorage;
|
|
|
|
private TextView tvPasswordStorage;
|
|
|
|
|
|
|
|
private CheckBox cbLogin;
|
|
|
|
private Button btnCertificate;
|
|
|
|
private Button btnCertificate;
|
|
|
|
private TextView tvCertificate;
|
|
|
|
private TextView tvCertificate;
|
|
|
|
private EditText etRealm;
|
|
|
|
private EditText etRealm;
|
|
|
@ -218,6 +219,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
etUser = view.findViewById(R.id.etUser);
|
|
|
|
etUser = view.findViewById(R.id.etUser);
|
|
|
|
tilPassword = view.findViewById(R.id.tilPassword);
|
|
|
|
tilPassword = view.findViewById(R.id.tilPassword);
|
|
|
|
tvPasswordStorage = view.findViewById(R.id.tvPasswordStorage);
|
|
|
|
tvPasswordStorage = view.findViewById(R.id.tvPasswordStorage);
|
|
|
|
|
|
|
|
cbLogin = view.findViewById(R.id.cbLoginBeforeSend);
|
|
|
|
btnCertificate = view.findViewById(R.id.btnCertificate);
|
|
|
|
btnCertificate = view.findViewById(R.id.btnCertificate);
|
|
|
|
tvCertificate = view.findViewById(R.id.tvCertificate);
|
|
|
|
tvCertificate = view.findViewById(R.id.tvCertificate);
|
|
|
|
etRealm = view.findViewById(R.id.etRealm);
|
|
|
|
etRealm = view.findViewById(R.id.etRealm);
|
|
|
@ -799,6 +801,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
args.putString("provider", provider);
|
|
|
|
args.putString("provider", provider);
|
|
|
|
args.putString("user", etUser.getText().toString().trim());
|
|
|
|
args.putString("user", etUser.getText().toString().trim());
|
|
|
|
args.putString("password", tilPassword.getEditText().getText().toString());
|
|
|
|
args.putString("password", tilPassword.getEditText().getText().toString());
|
|
|
|
|
|
|
|
args.putBoolean("login", cbLogin.isChecked());
|
|
|
|
args.putString("certificate", certificate);
|
|
|
|
args.putString("certificate", certificate);
|
|
|
|
args.putString("realm", etRealm.getText().toString());
|
|
|
|
args.putString("realm", etRealm.getText().toString());
|
|
|
|
args.putString("fingerprint", cbTrust.isChecked() ? (String) cbTrust.getTag() : null);
|
|
|
|
args.putString("fingerprint", cbTrust.isChecked() ? (String) cbTrust.getTag() : null);
|
|
|
@ -854,6 +857,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
String provider = args.getString("provider");
|
|
|
|
String provider = args.getString("provider");
|
|
|
|
String user = args.getString("user").trim();
|
|
|
|
String user = args.getString("user").trim();
|
|
|
|
String password = args.getString("password");
|
|
|
|
String password = args.getString("password");
|
|
|
|
|
|
|
|
boolean login = args.getBoolean("login");
|
|
|
|
String certificate = args.getString("certificate");
|
|
|
|
String certificate = args.getString("certificate");
|
|
|
|
String realm = args.getString("realm");
|
|
|
|
String realm = args.getString("realm");
|
|
|
|
String fingerprint = args.getString("fingerprint");
|
|
|
|
String fingerprint = args.getString("fingerprint");
|
|
|
@ -1019,6 +1023,8 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
if (!Objects.equals(identity.password, password))
|
|
|
|
if (!Objects.equals(identity.password, password))
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (!Objects.equals(identity.login, login))
|
|
|
|
|
|
|
|
return true;
|
|
|
|
if (!Objects.equals(identity.certificate_alias, certificate))
|
|
|
|
if (!Objects.equals(identity.certificate_alias, certificate))
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
if (!Objects.equals(identity.realm, realm))
|
|
|
|
if (!Objects.equals(identity.realm, realm))
|
|
|
@ -1087,6 +1093,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
Integer.parseInt(port) != identity.port ||
|
|
|
|
Integer.parseInt(port) != identity.port ||
|
|
|
|
!user.equals(identity.user) ||
|
|
|
|
!user.equals(identity.user) ||
|
|
|
|
!password.equals(identity.password) ||
|
|
|
|
!password.equals(identity.password) ||
|
|
|
|
|
|
|
|
!Objects.equals(login, identity.login) ||
|
|
|
|
!Objects.equals(certificate, identity.certificate_alias) ||
|
|
|
|
!Objects.equals(certificate, identity.certificate_alias) ||
|
|
|
|
!Objects.equals(realm, identityRealm) ||
|
|
|
|
!Objects.equals(realm, identityRealm) ||
|
|
|
|
!Objects.equals(fingerprint, identity.fingerprint) ||
|
|
|
|
!Objects.equals(fingerprint, identity.fingerprint) ||
|
|
|
@ -1103,6 +1110,14 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
// Check SMTP server
|
|
|
|
// Check SMTP server
|
|
|
|
Long server_max_size = null;
|
|
|
|
Long server_max_size = null;
|
|
|
|
if (check) {
|
|
|
|
if (check) {
|
|
|
|
|
|
|
|
if (login) {
|
|
|
|
|
|
|
|
EntityAccount a = db.account().getAccount(account);
|
|
|
|
|
|
|
|
if (a != null)
|
|
|
|
|
|
|
|
try (EmailService iaccount = new EmailService(context, a, EmailService.PURPOSE_CHECK, true)) {
|
|
|
|
|
|
|
|
iaccount.connect(a);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Create transport
|
|
|
|
// Create transport
|
|
|
|
String protocol = (encryption == EmailService.ENCRYPTION_SSL ? "smtps" : "smtp");
|
|
|
|
String protocol = (encryption == EmailService.ENCRYPTION_SSL ? "smtps" : "smtp");
|
|
|
|
try (EmailService iservice = new EmailService(context,
|
|
|
|
try (EmailService iservice = new EmailService(context,
|
|
|
@ -1148,6 +1163,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
identity.auth_type = auth;
|
|
|
|
identity.auth_type = auth;
|
|
|
|
identity.user = user;
|
|
|
|
identity.user = user;
|
|
|
|
identity.password = password;
|
|
|
|
identity.password = password;
|
|
|
|
|
|
|
|
identity.login = login;
|
|
|
|
identity.certificate_alias = certificate;
|
|
|
|
identity.certificate_alias = certificate;
|
|
|
|
identity.provider = provider;
|
|
|
|
identity.provider = provider;
|
|
|
|
identity.realm = realm;
|
|
|
|
identity.realm = realm;
|
|
|
@ -1331,6 +1347,7 @@ public class FragmentIdentity extends FragmentBase {
|
|
|
|
etPort.setText(identity == null ? null : Long.toString(identity.port));
|
|
|
|
etPort.setText(identity == null ? null : Long.toString(identity.port));
|
|
|
|
etUser.setText(identity == null ? null : identity.user);
|
|
|
|
etUser.setText(identity == null ? null : identity.user);
|
|
|
|
tilPassword.getEditText().setText(identity == null ? null : identity.password);
|
|
|
|
tilPassword.getEditText().setText(identity == null ? null : identity.password);
|
|
|
|
|
|
|
|
cbLogin.setChecked((identity != null && identity.login));
|
|
|
|
certificate = (identity == null ? null : identity.certificate_alias);
|
|
|
|
certificate = (identity == null ? null : identity.certificate_alias);
|
|
|
|
tvCertificate.setText(certificate == null ? getString(R.string.title_optional) : certificate);
|
|
|
|
tvCertificate.setText(certificate == null ? getString(R.string.title_optional) : certificate);
|
|
|
|
etRealm.setText(identity == null ? null : identity.realm);
|
|
|
|
etRealm.setText(identity == null ? null : identity.realm);
|
|
|
|