[epiphany/mcatanzaro/password-fun-never-stops: 7/7] Fix password manager for forms with no username



commit 3aeea5efd49739dcd7e01017532839f40c57db78
Author: Michael Catanzaro <mcatanzaro gnome org>
Date:   Wed Feb 12 17:17:14 2020 -0600

    Fix password manager for forms with no username
    
    In 8036139d, I once again broke the password manager for forms with no
    username. I think I will continue to break the password manager every
    time I make any change to it, so long as we don't have any tests.
    
    This reverts 8036139d and ensures we pass along a null formAuth when
    there are no results, like we used to do.

 embed/web-process-extension/resources/js/ephy.js | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/embed/web-process-extension/resources/js/ephy.js 
b/embed/web-process-extension/resources/js/ephy.js
index 41c8856cf..b487528ad 100644
--- a/embed/web-process-extension/resources/js/ephy.js
+++ b/embed/web-process-extension/resources/js/ephy.js
@@ -345,9 +345,7 @@ Ephy.PasswordManager = class PasswordManager
 
         let element = this._takePendingPromise(id);
         if (element) {
-            if (username === '')
-                username = null;
-            if (password !== '')
+            if (password)
                 element.resolver({username, password});
             else
                 element.resolver(null);
@@ -483,7 +481,7 @@ Ephy.FormManager = class FormManager
             formAuth.username,
             formAuth.usernameField,
             formAuth.passwordField).then(authInfo => {
-                if (!authInfo.username) {
+                if (!authInfo) {
                     Ephy.log('No result');
                     return;
                 }
@@ -529,7 +527,7 @@ Ephy.FormManager = class FormManager
             formAuth.username,
             formAuth.usernameField,
             formAuth.passwordField).then(authInfo => {
-                if (authInfo.username) {
+                if (authInfo) {
                     if (authInfo.username == formAuth.username && authInfo.password == formAuth.password) {
                         Ephy.log('User/password already stored. Not asking about storing.');
                         return;
@@ -558,7 +556,7 @@ Ephy.FormManager = class FormManager
                                                  formAuth.password,
                                                  formAuth.usernameField,
                                                  formAuth.passwordField,
-                                                 authInfo.username == null,
+                                                 authInfo == null,
                                                  this._pageID);
             }
         );


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