summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2018-08-18 16:40:19 +0200
committerGitHub <noreply@github.com>2018-08-18 16:40:19 +0200
commit154568268bdb887303c02fc8b41830c954d72ea4 (patch)
tree161b253cdbc0bad51d28562712bf5d170ce23c3d
parenta47795769ffa59adb78055f0e128544211ab52c5 (diff)
downloadmidori-git-154568268bdb887303c02fc8b41830c954d72ea4.tar.gz
Consider non-TLS and partially insecure sites insecure (#14)
![screenshot from 2018-08-18 16-33-12](https://user-images.githubusercontent.com/1204189/44300315-296d6800-a305-11e8-8e3c-9a951760cd91.png) An additional label above the certificate details will point out, if needed, that the connection (website) isn't considered secure. In the same cases the left hand icon in the urlbar will show an "insecure" icon.
-rw-r--r--core/tab.vala4
-rw-r--r--core/urlbar.vala22
-rw-r--r--ui/urlbar.ui6
3 files changed, 25 insertions, 7 deletions
diff --git a/core/tab.vala b/core/tab.vala
index a33f8d15..f80af75a 100644
--- a/core/tab.vala
+++ b/core/tab.vala
@@ -115,6 +115,10 @@ namespace Midori {
}
}
+ public override void insecure_content_detected (WebKit.InsecureContentEvent event) {
+ secure = false;
+ }
+
public override bool web_process_crashed () {
return display_error ("face-sad", _("Oops - %s").printf (uri), _("Something went wrong with '%s'.").printf (uri));
}
diff --git a/core/urlbar.vala b/core/urlbar.vala
index 48bef498..69f0b562 100644
--- a/core/urlbar.vala
+++ b/core/urlbar.vala
@@ -22,14 +22,20 @@ namespace Midori {
_uri = value;
location = value;
// Treat about:blank specially
- text = value != "about:blank" ? value : "";
+ text = blank ? "" : value;
+ secure = false;
} }
bool _secure = false;
public bool secure { get { return _secure; } set {
_secure = value;
- primary_icon_name = value ? "channel-secure-symbolic" : null;
- primary_icon_activatable = value;
+ if (blank) {
+ primary_icon_name = null;
+ } else {
+ primary_icon_name = value ? "channel-secure-symbolic" : "channel-insecure-symbolic";
+ }
+ primary_icon_activatable = !blank;
} }
+ bool blank { get { return uri == "about:blank"; } }
[GtkChild]
Gtk.Popover? suggestions;
@@ -40,6 +46,8 @@ namespace Midori {
Gtk.Popover security;
[GtkChild]
Gtk.Box security_box;
+ [GtkChild]
+ Gtk.Label security_status;
Gcr.CertificateWidget? details = null;
construct {
@@ -300,13 +308,13 @@ namespace Midori {
// Insert widget here because Gtk.Builder won't recognize the type
details = new Gcr.CertificateWidget (null);
- details.show ();
security_box.add (details);
- security_box.reorder_child (details, 0);
- } else {
- details.certificate = certificate;
}
+ details.visible = tls != null;
+ details.certificate = certificate;
+ security_status.visible = !secure;
security.show ();
}
}
+
}
diff --git a/ui/urlbar.ui b/ui/urlbar.ui
index 3b31b824..43053764 100644
--- a/ui/urlbar.ui
+++ b/ui/urlbar.ui
@@ -10,12 +10,18 @@
</object>
<object class="GtkPopover" id="security">
<property name="modal">yes</property>
+ <property name="position">bottom</property>
<child>
<object class="GtkBox" id="security_box">
<property name="margin">4</property>
<property name="spacing">4</property>
<property name="orientation">vertical</property>
<property name="visible">yes</property>
+ <child>
+ <object class="GtkLabel" id="security_status">
+ <property name="label" translatable="yes">Connection is not secure</property>
+ </object>
+ </child>
</object>
</child>
</object>