Add warning message when using http
This commit is contained in:
@@ -102,11 +102,16 @@ public class LoginActivity extends AppCompatActivity {
|
||||
@OnClick(R.id.checkurl)
|
||||
public void doCheckUrl() {
|
||||
String url = urlField.getText().toString();
|
||||
if (HttpUrl.parse(url) == null) {
|
||||
HttpUrl parsedUrl = HttpUrl.parse(url);
|
||||
if (parsedUrl == null) {
|
||||
Utils.showSnackBar(LoginActivity.this, "Invalid URL (include http:// or https://)");
|
||||
return;
|
||||
}
|
||||
|
||||
if ("http".equals(parsedUrl.scheme())) {
|
||||
showHttpWarning();
|
||||
}
|
||||
|
||||
checkUrlProgress.setVisibility(View.VISIBLE);
|
||||
checkUrlButton.setVisibility(View.GONE);
|
||||
|
||||
@@ -117,6 +122,15 @@ public class LoginActivity extends AppCompatActivity {
|
||||
.enqueue(callInUI(this, onValidUrl(fixedUrl), onInvalidUrl(fixedUrl)));
|
||||
}
|
||||
|
||||
public void showHttpWarning() {
|
||||
new AlertDialog.Builder(this)
|
||||
.setTitle(R.string.warning)
|
||||
.setCancelable(true)
|
||||
.setMessage(R.string.http_warning)
|
||||
.setPositiveButton(R.string.i_understand, (a, b) -> {})
|
||||
.show();
|
||||
}
|
||||
|
||||
@OnClick(R.id.open_logs)
|
||||
public void openLogs() {
|
||||
startActivity(new Intent(this, LogsActivity.class));
|
||||
|
||||
@@ -54,4 +54,7 @@
|
||||
<string name="done">Done</string>
|
||||
<string name="no_certificate_selected">No certificate selected</string>
|
||||
<string name="remove_ca_certificate">Remove CA Certificate</string>
|
||||
<string name="warning">Warning</string>
|
||||
<string name="http_warning">Using http is insecure and it\'s recommend to use https instead. Use your favorite search engine to get more information about this topic.</string>
|
||||
<string name="i_understand">I Understand</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user