Thanks a lot!
I addition to your link I found this post about how to use it in
Thunderbird:
https://mail.mozilla.org/pipermail/tb-enterprise/2012-November/000670.html
> <mailto:
hans....@ofd-z.niedersachsen.de>> wrote:
>
> Hi,
>
> I'm dealing with an extension build by a third party for us. This is
> still working in Thunderbird 2.0.
>
> We are about to update to ESR 17 now.
> Most of the extension sill works, which is fine.
>
> There is a "Change Password" function, which updates the users
> password in LDAP and changes in the password manager.
> Changing the pw in LDAP still works too (This is done via an HTTP
> gateway; it think these are the "ajax" code line for, right?).
> But the extension seems to hang while trying to update the pw in the
> pw manager.
>
> Here is the code for saving the new password:
>
> saveData: function(){
> // password validation skipped
> // [...]
> //
> var ajax = new
> OFDhttp(OFDtools.getPref('__extensions.ofd.gateway'));
> ajax.setVar('do','newpass');
> ajax.setVar('newpass',p1);
> var serv =
> OFDtools.getAccountServer(__document.getElementById('ofd-__mailaccounts'));
> ajax.setVar('user',serv.__realUsername);
> ajax.setVar('pass',serv.__password);
> ajax.setVar('host',serv.__realHostName);
> ajax.onCompletion = function() {
> ofdpassword.handleSave(this,__serv) };
>
> ajax.runAJAX();
> return false;
> }
> handleSave: function(ajax,serv){
> var newpass = ajax.data;
>
> // save back to password manager
> var pm =
> OFDtools.getService('@mozilla.__org/passwordmanager;1
> pm.addUser(serv.type+'://'+__encodeURIComponent(serv.__username)+'@'+
> encodeURIComponent(serv.__hostName),
> serv.realUsername, newpass);
> // smtp
>
> pm.addUser('smtp://'+__encodeURIComponent(serv.__realUsername)+'@'+
> encodeURIComponent(serv.__hostName),
> serv.realUsername, newpass);
>
> OFDtools.alert('Your Password has changed','Ok');
>
> }
>
> Is there an easy way to change the code to get it working again?
> Can someone point me in the right direction?
I changed my code to this:
handleSave: function(ajax,serv){
var newpass = ajax.data;
var nsLoginInfo = new Components.Constructor(
"@
mozilla.org/login-manager/loginInfo;1",
Components.interfaces.nsILoginInfo,
"init"
);
// imap
//pm.addUser(serv.type+'://'+encodeURIComponent(serv.username)+'@'+
// encodeURIComponent(serv.hostName), serv.realUsername, newpass);
var loginInfo_IMAP = new nsLoginInfo("imap://" + serv.hostName, "", "",
serv.realUsername, "", newpass);
loginManager.addLogin(loginInfo_IMAP);
// smtp
//pm.addUser('smtp://'+encodeURIComponent(serv.realUsername)+'@'+
// encodeURIComponent(serv.hostName), serv.realUsername, newpass);
var loginInfo_SMTP = new nsLoginInfo("smtp://" + serv.hostName, "", "",
serv.realUsername, "", newpass);
loginManager.addLogin(loginInfo_SMTP);
OFDtools.alert('Your password has changed','Ok');
}
But it still does not work. I still have the "spinning wheel" waiting
for something to end, which does not happen.
The password is sill updated in LDAP though.
Because of the difficulties in updating entries in the password manager
mentioned in the documentation, I tried with an an empty password
manger. Without success.
Something still seams to be wrong here.
Marc