Skip to content

Commit

Permalink
[embedlite-components] Call showChangeLoginNotification always when u…
Browse files Browse the repository at this point in the history
…pdating password. Fixes JB#53604

This commits also drops unnecessary _showChangeLoginDialog.
  • Loading branch information
rainemak committed Mar 19, 2021
1 parent 5f68844 commit 5d0a929
Showing 1 changed file with 1 addition and 43 deletions.
44 changes: 1 addition & 43 deletions jscomps/nsLoginManagerPrompter.js
Expand Up @@ -1184,14 +1184,7 @@ LoginManagerPrompter.prototype = {
*/
promptToChangePassword(aOldLogin, aNewLogin) {
this.log("promptToChangePassword");
let notifyObj = this._getPopupNote() || this._getNotifyBox();

if (notifyObj) {
this._showChangeLoginNotification(notifyObj, aOldLogin,
aNewLogin);
} else {
this._showChangeLoginDialog(aOldLogin, aNewLogin);
}
this._showChangeLoginNotification({}, aOldLogin, aNewLogin);
},

/**
Expand Down Expand Up @@ -1274,41 +1267,6 @@ LoginManagerPrompter.prototype = {
Services.obs.notifyObservers(aNewLogin, "passwordmgr-prompt-change", oldGUID);
},


/**
* Shows the Change Password dialog.
*/
_showChangeLoginDialog(aOldLogin, aNewLogin) {
const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;

var dialogText;
if (aOldLogin.username)
dialogText = this._getLocalizedString(
"updatePasswordMsg",
[aOldLogin.username]);
else
dialogText = this._getLocalizedString(
"updatePasswordMsgNoUser");

var dialogTitle = this._getLocalizedString(
"passwordChangeTitle");

// returns 1 for yes, 0 for no.
var ok = this._promptService.confirmEx(this._chromeWindow,
dialogTitle, dialogText, buttonFlags,
null, null, null,
null, {});

if (ok) {
this.log("Updating password for user " + aOldLogin.username);
this._updateLogin(aOldLogin, aNewLogin);
}

let oldGUID = aOldLogin.QueryInterface(Ci.nsILoginMetaInfo).guid;
Services.obs.notifyObservers(aNewLogin, "passwordmgr-prompt-change", oldGUID);
},


/**
* Called when we detect a password change in a form submission, but we
* don't know which existing login (username) it's for. Asks the user
Expand Down

0 comments on commit 5d0a929

Please sign in to comment.