[epiphany] web-extension: Only offer to remember nonempty passwords



commit 51aac016a5a28c7bddf797453db28a7d54b3f7bb
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Jan 4 10:51:03 2017 -0600

    web-extension: Only offer to remember nonempty passwords
    
    Asking to remember an empty password is stupid. Avoids the password
    prompt on sites like paste.gnome.org and paste.fedoraproject.org.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771073

 embed/web-extension/ephy-web-extension.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index 81ab6f3..e10a346 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -360,6 +360,7 @@ should_store_cb (const char *username,
   EphyHostPermission permission;
   SoupURI *uri;
   char *uri_string;
+  char *password_field_value = NULL;
 
   uri = ephy_embed_form_auth_get_uri (form_auth);
   uri_string = soup_uri_to_string (uri, FALSE);
@@ -376,16 +377,18 @@ should_store_cb (const char *username,
     goto out;
   }
 
+  g_object_get (ephy_embed_form_auth_get_password_node (form_auth),
+                "value", &password_field_value, NULL);
+  if (password_field_value == NULL || strlen (password_field_value) == 0)
+    goto out;
+
   if (password) {
     WebKitDOMNode *username_node;
     char *username_field_value = NULL;
-    char *password_field_value = NULL;
 
     username_node = ephy_embed_form_auth_get_username_node (form_auth);
     if (username_node)
       g_object_get (username_node, "value", &username_field_value, NULL);
-    g_object_get (ephy_embed_form_auth_get_password_node (form_auth),
-                  "value", &password_field_value, NULL);
 
     /* FIXME: We use only the first result, for now; We need to do
      * something smarter here */
@@ -401,7 +404,7 @@ should_store_cb (const char *username,
     }
 
     g_free (username_field_value);
-    g_free (password_field_value);
+
   } else if (permission == EPHY_HOST_PERMISSION_ALLOW) {
     LOG ("No result on query; storing.");
     store_password (form_auth);
@@ -411,6 +414,8 @@ should_store_cb (const char *username,
   }
 
 out:
+  if (password_field_value)
+    g_free (password_field_value);
   g_free (uri_string);
 }
 


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