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); 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); 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); 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); 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); 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); list-style-image: url(chrome://mozapps/skin/passwordmgr/key-64.png);
} }

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

@ -21,6 +21,7 @@
* Justin Dolske <dolske@mozilla.com> (original author) * Justin Dolske <dolske@mozilla.com> (original author)
* Ehsan Akhgari <ehsan.akhgari@gmail.com> * Ehsan Akhgari <ehsan.akhgari@gmail.com>
* Frank Yan <fyan@mozilla.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 * 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 * 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 + this.log("Updating password for " + username +
" @ " + hostname + " (" + httpRealm + ")"); " @ " + hostname + " (" + httpRealm + ")");
if (notifyBox) var notifyObj = this._getPopupNote() || notifyBox;
this._showChangeLoginNotification(notifyBox, if (notifyObj)
this._showChangeLoginNotification(notifyObj,
selectedLogin, password); selectedLogin, password);
else else
this._updateLogin(selectedLogin, password); this._updateLogin(selectedLogin, password);
@ -1011,10 +1013,11 @@ LoginManagerPrompter.prototype = {
* *
*/ */
promptToChangePassword : function (aOldLogin, aNewLogin) { promptToChangePassword : function (aOldLogin, aNewLogin) {
var notifyBox = this._getNotifyBox(); var notifyObj = this._getPopupNote() || this._getNotifyBox();
if (notifyBox) if (notifyObj)
this._showChangeLoginNotification(notifyBox, aOldLogin, aNewLogin.password); this._showChangeLoginNotification(notifyObj, aOldLogin,
aNewLogin.password);
else else
this._showChangeLoginDialog(aOldLogin, aNewLogin.password); this._showChangeLoginDialog(aOldLogin, aNewLogin.password);
}, },
@ -1023,10 +1026,12 @@ LoginManagerPrompter.prototype = {
/* /*
* _showChangeLoginNotification * _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; var notificationText;
if (aOldLogin.username) if (aOldLogin.username)
notificationText = this._getLocalizedString( notificationText = this._getLocalizedString(
@ -1050,30 +1055,52 @@ LoginManagerPrompter.prototype = {
// without a getService() call. // without a getService() call.
var self = this; var self = this;
var buttons = [ // Notification is a PopupNotification
if (aNotifyObj == this._getPopupNote()) {
// "Yes" button // "Yes" button
{ var mainAction = {
label: changeButtonText, label: changeButtonText,
accessKey: changeButtonAccessKey, accessKey: changeButtonAccessKey,
popup: null, popup: null,
callback: function(aNotificationBar, aButton) { callback: function(aNotifyObj, aButton) {
self._updateLogin(aOldLogin, aNewPassword); self._updateLogin(aOldLogin, aNewPassword);
} }
}, };
// "No" button var notifyWin = this._getNotifyWindow();
{ var chromeWin = this._getChromeWindow(notifyWin).wrappedJSObject;
label: dontChangeButtonText, var browser = chromeWin.gBrowser.
accessKey: dontChangeButtonAccessKey, getBrowserForDocument(this._window.top.document);
popup: null,
callback: function(aNotificationBar, aButton) { aNotifyObj.show(browser, "password-change", notificationText,
// do nothing "password-notification-icon", mainAction,
null, { timeout: Date.now() + 30000 });
} else {
var buttons = [
// "Yes" button
{
label: changeButtonText,
accessKey: changeButtonAccessKey,
popup: null,
callback: function(aNotifyObj, aButton) {
self._updateLogin(aOldLogin, aNewPassword);
}
},
// "No" button
{
label: dontChangeButtonText,
accessKey: dontChangeButtonAccessKey,
popup: null,
callback: function(aNotifyObj, aButton) {
// do nothing
}
} }
} ];
];
this._showLoginNotification(aNotifyObj, "password-change",
this._showLoginNotification(aNotifyBox, "password-change", notificationText, buttons);
notificationText, buttons); }
}, },