[epiphany] Use known credentials on first authentication try



commit 88d166416476f72f4e47e04091048ee401a1cdef
Author: Jan-Michael Brummer <jan brummer tabos org>
Date:   Sun Apr 7 22:48:52 2019 +0200

    Use known credentials on first authentication try
    
    In case we have known credentials and it is the firs try, authenticate automatically,

 embed/ephy-web-view.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
---
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index a7727c59b..6eebf3ed2 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -2806,6 +2806,24 @@ reader_setting_changed_cb (GSettings   *settings,
   g_free (js_snippet);
 }
 
+static gboolean
+authenticate_cb (WebKitWebView               *web_view,
+                 WebKitAuthenticationRequest *request,
+                 gpointer                     user_data)
+{
+  g_autoptr(WebKitCredential) credential = NULL;
+
+  credential = webkit_authentication_request_get_proposed_credential (request);
+
+  /* In case we have known credentials and it is the firs try, authenticate automatically */
+  if (credential && !webkit_authentication_request_is_retry (request)) {
+    webkit_authentication_request_authenticate (request, credential);
+    return TRUE;
+  }
+
+  return FALSE;
+}
+
 static void
 ephy_web_view_init (EphyWebView *web_view)
 {
@@ -2882,6 +2900,10 @@ ephy_web_view_init (EphyWebView *web_view)
                     G_CALLBACK (new_window_cb),
                     NULL);
 
+  g_signal_connect (web_view, "authenticate",
+                    G_CALLBACK (authenticate_cb),
+                    NULL);
+
   g_signal_connect_object (ephy_embed_shell_get_default (), "page-created",
                            G_CALLBACK (page_created_cb),
                            web_view, 0);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]