Bug 588309 - Convert change password to a doorhanger panel. r=dolske, a=blocking2.0

This commit is contained in:
Margaret Leibovic 2010-09-09 19:08:26 -07:00
Родитель 6d401b471c
Коммит 9ec275a85b
4 изменённых файлов: 57 добавлений и 27 удалений

Просмотреть файл

@ -1039,7 +1039,8 @@ toolbar[iconsize="small"] #fullscreen-button {
list-style-image: url(chrome://global/skin/icons/question-64.png);
}
.popup-notification-icon[popupid="password-save"] {
.popup-notification-icon[popupid="password-save"],
.popup-notification-icon[popupid="password-change"] {
list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png);
}

Просмотреть файл

@ -1975,7 +1975,8 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
list-style-image: url(chrome://global/skin/icons/question-64.png);
}
.popup-notification-icon[popupid="password-save"] {
.popup-notification-icon[popupid="password-save"],
.popup-notification-icon[popupid="password-change"] {
list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png);
}

Просмотреть файл

@ -1890,7 +1890,8 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://global/skin/icons/question-64.png);
}
.popup-notification-icon[popupid="password-save"] {
.popup-notification-icon[popupid="password-save"],
.popup-notification-icon[popupid="password-change"] {
list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png);
}

Просмотреть файл

@ -21,6 +21,7 @@
* Justin Dolske <dolske@mozilla.com> (original author)
* Ehsan Akhgari <ehsan.akhgari@gmail.com>
* Frank Yan <fyan@mozilla.com>
* Margaret Leibovic <margaret.leibovic@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -663,8 +664,9 @@ LoginManagerPrompter.prototype = {
this.log("Updating password for " + username +
" @ " + hostname + " (" + httpRealm + ")");
if (notifyBox)
this._showChangeLoginNotification(notifyBox,
var notifyObj = this._getPopupNote() || notifyBox;
if (notifyObj)
this._showChangeLoginNotification(notifyObj,
selectedLogin, password);
else
this._updateLogin(selectedLogin, password);
@ -1011,10 +1013,11 @@ LoginManagerPrompter.prototype = {
*
*/
promptToChangePassword : function (aOldLogin, aNewLogin) {
var notifyBox = this._getNotifyBox();
var notifyObj = this._getPopupNote() || this._getNotifyBox();
if (notifyBox)
this._showChangeLoginNotification(notifyBox, aOldLogin, aNewLogin.password);
if (notifyObj)
this._showChangeLoginNotification(notifyObj, aOldLogin,
aNewLogin.password);
else
this._showChangeLoginDialog(aOldLogin, aNewLogin.password);
},
@ -1023,10 +1026,12 @@ LoginManagerPrompter.prototype = {
/*
* _showChangeLoginNotification
*
* Shows the Change Password notification bar.
* Shows the Change Password notification bar or popup notification.
*
* @param aNotifyObj
* A notification box or a popup notification.
*/
_showChangeLoginNotification : function (aNotifyBox, aOldLogin, aNewPassword) {
_showChangeLoginNotification : function (aNotifyObj, aOldLogin, aNewPassword) {
var notificationText;
if (aOldLogin.username)
notificationText = this._getLocalizedString(
@ -1050,13 +1055,34 @@ LoginManagerPrompter.prototype = {
// without a getService() call.
var self = this;
// Notification is a PopupNotification
if (aNotifyObj == this._getPopupNote()) {
// "Yes" button
var mainAction = {
label: changeButtonText,
accessKey: changeButtonAccessKey,
popup: null,
callback: function(aNotifyObj, aButton) {
self._updateLogin(aOldLogin, aNewPassword);
}
};
var notifyWin = this._getNotifyWindow();
var chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
var browser = chromeWin.gBrowser.
getBrowserForDocument(this._window.top.document);
aNotifyObj.show(browser, "password-change", notificationText,
"password-notification-icon", mainAction,
null, { timeout: Date.now() + 30000 });
} else {
var buttons = [
// "Yes" button
{
label: changeButtonText,
accessKey: changeButtonAccessKey,
popup: null,
callback: function(aNotificationBar, aButton) {
callback: function(aNotifyObj, aButton) {
self._updateLogin(aOldLogin, aNewPassword);
}
},
@ -1066,14 +1092,15 @@ LoginManagerPrompter.prototype = {
label: dontChangeButtonText,
accessKey: dontChangeButtonAccessKey,
popup: null,
callback: function(aNotificationBar, aButton) {
callback: function(aNotifyObj, aButton) {
// do nothing
}
}
];
this._showLoginNotification(aNotifyBox, "password-change",
this._showLoginNotification(aNotifyObj, "password-change",
notificationText, buttons);
}
},