[epiphany/mcatanzaro/passwords-never-work] Fix saving new passwords not working



commit 8036139d22870394d59c41976821b4519059e68c
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Sat Feb 1 11:37:59 2020 -0600

    Fix saving new passwords not working
    
    authInfo is no longer ever null here, most likely since b7381c71.
    Instead of checking for it to be null, check whether username is set
    instead. Otherwise we wind up in the update existing password codepath
    even for new passwords, which guarantees failure because that codepath
    will never save a new password.
    
    Fixes #1064

 embed/web-process-extension/resources/js/ephy.js | 6 +++---
 lib/sync/ephy-password-manager.c                 | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/embed/web-process-extension/resources/js/ephy.js 
b/embed/web-process-extension/resources/js/ephy.js
index aecddbc18..eed875246 100644
--- a/embed/web-process-extension/resources/js/ephy.js
+++ b/embed/web-process-extension/resources/js/ephy.js
@@ -460,7 +460,7 @@ Ephy.FormManager = class FormManager
             formAuth.username,
             formAuth.usernameField,
             formAuth.passwordField).then(authInfo => {
-                if (!authInfo) {
+                if (!authInfo.username) {
                     Ephy.log('No result');
                     return;
                 }
@@ -506,7 +506,7 @@ Ephy.FormManager = class FormManager
             formAuth.username,
             formAuth.usernameField,
             formAuth.passwordField).then(authInfo => {
-                if (authInfo) {
+                if (authInfo.username) {
                     if (authInfo.username == formAuth.username && authInfo.password == formAuth.password) {
                         Ephy.log('User/password already stored. Not asking about storing.');
                         return;
@@ -535,7 +535,7 @@ Ephy.FormManager = class FormManager
                                                  formAuth.password,
                                                  formAuth.usernameField,
                                                  formAuth.passwordField,
-                                                 authInfo == null,
+                                                 authInfo.username == null,
                                                  this._pageID);
             }
         );
diff --git a/lib/sync/ephy-password-manager.c b/lib/sync/ephy-password-manager.c
index fa81ea190..d7028dd26 100644
--- a/lib/sync/ephy-password-manager.c
+++ b/lib/sync/ephy-password-manager.c
@@ -481,6 +481,8 @@ update_password_cb (GList    *records,
     ephy_password_manager_store_record (data->manager, record);
     g_signal_emit_by_name (data->manager, "synchronizable-modified", record, FALSE);
     g_list_free_full (records, g_object_unref);
+  } else {
+    LOG ("Attempted to update password record that doesn't exist (likely Epiphany bug)");
   }
 
   update_password_async_data_free (data);


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