diff --git a/res/layout/registration_activity.xml b/res/layout/registration_activity.xml index 27341517c..8e5639a6a 100644 --- a/res/layout/registration_activity.xml +++ b/res/layout/registration_activity.xml @@ -90,7 +90,7 @@ android:layout_height="wrap_content" android:visibility="gone" app:constraint_referenced_ids="inbox, imap_login, imap_server, imap_port, imap_security_label, imap_security, outbox_view_spacer_top, - outbox, smtp_login, smtp_password, smtp_server, smtp_port, smtp_security_label, smtp_security, auth_method_label, auth_method, view_log_button" /> + outbox, smtp_login, smtp_password, smtp_server, smtp_port, smtp_security_label, smtp_security, auth_method_label, auth_method, cert_check_label, cert_check, view_log_button" /> + + + + + app:layout_constraintTop_toBottomOf="@id/cert_check" /> 1 + + @string/automatic + @string/strict + @string/accept_invalid_hostnames + @string/accept_invalid_certificates + + diff --git a/res/values/strings.xml b/res/values/strings.xml index a388eaaf7..73ed75d54 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -339,6 +339,7 @@ Cannot login as \"%1$s\". Please check if the email-address and the password are correct. Response from %1$s: %2$s\n\nSome providers place additional information in your inbox; you can check them it eg. in the web frontend. Consult your provider or friends if you run into problems. + IMAP/SMTP certificate checks Accept invalid hostnames diff --git a/src/org/thoughtcrime/securesms/RegistrationActivity.java b/src/org/thoughtcrime/securesms/RegistrationActivity.java index 1b70e566a..80d3a2a09 100644 --- a/src/org/thoughtcrime/securesms/RegistrationActivity.java +++ b/src/org/thoughtcrime/securesms/RegistrationActivity.java @@ -67,6 +67,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve Spinner imapSecurity; Spinner smtpSecurity; Spinner authMethod; + Spinner certCheck; @Override public void onCreate(Bundle bundle) { @@ -89,6 +90,7 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve imapSecurity = findViewById(R.id.imap_security); smtpSecurity = findViewById(R.id.smtp_security); authMethod = findViewById(R.id.auth_method); + certCheck = findViewById(R.id.cert_check); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { @@ -149,6 +151,9 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve sel = 0; if((server_flags&DcContext.DC_LP_AUTH_OAUTH2)!=0) sel = 1; authMethod.setSelection(sel); + + int certCheckFlags = DcHelper.getInt(this, "imap_certificate_checks"); + certCheck.setSelection(certCheckFlags); } DcHelper.getContext(this).eventCenter.addObserver(this, DcContext.DC_EVENT_CONFIGURE_PROGRESS); @@ -434,6 +439,9 @@ public class RegistrationActivity extends BaseActionBarActivity implements DcEve if(authMethod.getSelectedItemPosition()==1) server_flags |= DcContext.DC_LP_AUTH_OAUTH2; DcHelper.getContext(this).setConfigInt("server_flags", server_flags); + DcHelper.getContext(this).setConfigInt("smtp_certificate_checks", certCheck.getSelectedItemPosition()); + DcHelper.getContext(this).setConfigInt("imap_certificate_checks", certCheck.getSelectedItemPosition()); + // calling configure() results in // receiving multiple DC_EVENT_CONFIGURE_PROGRESS events DcHelper.getContext(this).captureNextError();