[epiphany/gnome-3-22] web-extension: Only offer to remember nonempty passwords



commit b6fc61e0fdc1dd8e77f5c40fc1ed94eae46ea59d
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 |   14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/embed/web-extension/ephy-web-extension.c b/embed/web-extension/ephy-web-extension.c
index c284661..d528fe0 100644
--- a/embed/web-extension/ephy-web-extension.c
+++ b/embed/web-extension/ephy-web-extension.c
@@ -280,17 +280,20 @@ should_store_cb (const char *username,
                  gpointer    user_data)
 {
   EphyEmbedFormAuth *form_auth = EPHY_EMBED_FORM_AUTH (user_data);
+  char *password_field_value = NULL;
+
+  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 */
@@ -303,11 +306,14 @@ should_store_cb (const char *username,
     }
 
     g_free (username_field_value);
-    g_free (password_field_value);
   } else {
     LOG ("No result on query; asking whether we should store.");
     request_decision_on_storing (g_object_ref (form_auth));
   }
+
+out:
+  if (password_field_value != NULL)
+    g_free (password_field_value);
 }
 
 static gboolean


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