summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Dywan <christian@twotoasts.de>2019-07-07 15:29:31 +0200
committerGitHub <noreply@github.com>2019-07-07 15:29:31 +0200
commit34e938e2abf239df658bec91b6d8e708f5177f7a (patch)
tree674729acb235edab1087a47fc0e00ca9007a2217
parent485dc998d9a9486c8395788ef821172c1ad327b7 (diff)
downloadmidori-git-34e938e2abf239df658bec91b6d8e708f5177f7a.tar.gz
Add Trust button to the security details popover (#341)
If a certificate is available but considered invalid, the Trust button shows up in the details popover accessible via the icon in the urlbar. A temporary exception which is valid for the remainder of the session is added for the specific certificate and host combination. Note: No attempt is made to preserve the exception. Fixes: #182
-rw-r--r--core/urlbar.vala9
-rw-r--r--ui/urlbar.ui14
2 files changed, 23 insertions, 0 deletions
diff --git a/core/urlbar.vala b/core/urlbar.vala
index 4b4ed5a5..5f4e866f 100644
--- a/core/urlbar.vala
+++ b/core/urlbar.vala
@@ -43,6 +43,8 @@ namespace Midori {
[GtkChild]
Gtk.Box security_box;
[GtkChild]
+ Gtk.Button trust;
+ [GtkChild]
Gtk.Label security_status;
Gcr.CertificateWidget? details = null;
@@ -313,12 +315,19 @@ namespace Midori {
}
return true;
});
+ trust.clicked.connect (() => {
+ var tab = ((Browser)get_toplevel ()).tab;
+ tab.web_context.allow_tls_certificate_for_host (tab.tls, new Soup.URI (uri).host);
+ security.hide ();
+ tab.reload ();
+ });
// Insert widget here because Gtk.Builder won't recognize the type
details = new Gcr.CertificateWidget (null);
security_box.add (details);
}
details.visible = tls != null;
+ trust.visible = tls != null && !secure;
details.certificate = certificate;
security_status.visible = !secure;
security.show ();
diff --git a/ui/urlbar.ui b/ui/urlbar.ui
index c77e68bc..d03af168 100644
--- a/ui/urlbar.ui
+++ b/ui/urlbar.ui
@@ -22,6 +22,20 @@
<property name="label" translatable="yes">Security unknown</property>
</object>
</child>
+ <child>
+ <object class="GtkActionBar">
+ <property name="visible">yes</property>
+ <child>
+ <object class="GtkButton" id="trust">
+ <property name="label" translatable="yes">_Trust this website</property>
+ <property name="use-underline">yes</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="pack-type">end</property>
+ </packing>
+ </child>
</object>
</child>
</object>