зеркало из https://github.com/mozilla/gecko-dev.git
Make change password work (bug 505570)
This commit is contained in:
Родитель
454a197d48
Коммит
3fa5212903
|
@ -0,0 +1,28 @@
|
|||
noPassword.alert = You must enter a password.
|
||||
noPassphrase.alert = You must enter a passphrase.
|
||||
passwordNoMatch.alert = Your passwords do not match. Try again!
|
||||
passphraseNoMatch.alert = Your passphrases do not match. Try again!
|
||||
|
||||
change.password.title = Change your Password
|
||||
change.password.status.active = Changing your password...
|
||||
change.password.status.success = Your password has been changed.
|
||||
change.password.status.error = There was an error changing your password.
|
||||
change.password.status.passwordSameAsPassphrase = The password cannot be the same as the passphrase.
|
||||
change.password.status.passwordSameAsUsername = The password cannot be the same as the username.
|
||||
change.password.status.passwordsDoNotMatch = The passwords you entered do not match.
|
||||
change.password.status.badOldPassword = Your current password is incorrect.
|
||||
|
||||
change.passphrase.title = Change your Passphrase
|
||||
change.passphrase.label = Changing passphrase, please wait...
|
||||
change.passphrase.error = There was an error while changing your passphrase!
|
||||
change.passphrase.success = Your passphrase was successfully changed!
|
||||
|
||||
reset.passphrase.title = Reset your Passphrase
|
||||
reset.passphrase.label = Resetting passphrase, please wait...
|
||||
reset.passphrase.error = There was an error while resetting your passphrase!
|
||||
reset.passphrase.success = Your passphrase was successfully reset!
|
||||
|
||||
new.passphrase.label = Enter your new passphrase
|
||||
new.passphrase.confirm = Confirm your new passphrase
|
||||
new.password.label = Enter your new password
|
||||
new.password.confirm = Confirm your new password
|
|
@ -183,10 +183,16 @@ WeaveSvc.prototype = {
|
|||
},
|
||||
|
||||
get password() { return ID.get('WeaveID').password; },
|
||||
set password(value) { ID.get('WeaveID').password = value; },
|
||||
set password(value) {
|
||||
ID.get('WeaveID').setTempPassword(null);
|
||||
ID.get('WeaveID').password = value;
|
||||
},
|
||||
|
||||
get passphrase() { return ID.get('WeaveCryptoID').password; },
|
||||
set passphrase(value) { ID.get('WeaveCryptoID').password = value; },
|
||||
set passphrase(value) {
|
||||
ID.get('WeaveCryptoID').setTempPassword(null);
|
||||
ID.get('WeaveCryptoID').password = value;
|
||||
},
|
||||
|
||||
// chrome-provided callbacks for when the service needs a password/passphrase
|
||||
set onGetPassword(value) {
|
||||
|
@ -536,6 +542,27 @@ WeaveSvc.prototype = {
|
|||
return true;
|
||||
}))(),
|
||||
|
||||
changePassword: function WeaveSvc_changePassword(newpass)
|
||||
this._catch(this._notify("changepwd", "", function() {
|
||||
function enc(x) encodeURIComponent(x);
|
||||
let message = "uid=" + enc(this.username) + "&password=" +
|
||||
enc(this.password) + "&new=" + enc(newpass);
|
||||
let url = Svc.Prefs.get('tmpServerURL') + '0.3/api/register/chpwd';
|
||||
let res = new Weave.Resource(url);
|
||||
res.authenticator = new Weave.NoOpAuthenticator();
|
||||
res.setHeader("Content-Type", "application/x-www-form-urlencoded",
|
||||
"Content-Length", message.length);
|
||||
|
||||
let resp = res.post(message);
|
||||
if (res.lastChannel.responseStatus != 200) {
|
||||
this._log.info("Password change failed: " + resp);
|
||||
throw "Could not change password";
|
||||
}
|
||||
|
||||
this.password = newpass;
|
||||
return true;
|
||||
}))(),
|
||||
|
||||
resetPassphrase: function WeaveSvc_resetPassphrase(newphrase)
|
||||
this._catch(this._notify("resetpph", "", function() {
|
||||
/* Make remote commands ready so we have a list of clients beforehand */
|
||||
|
|
Загрузка…
Ссылка в новой задаче