Hi,
I was wondering whether it is is possible to modify a user's password using Jabber Net. If so, is there a neat way to verify first that the old password is indeed valid before modifying it to the new one?
Hi,
I was wondering whether it is is possible to modify a user's password using Jabber Net. If so, is there a neat way to verify first that the old password is indeed valid before modifying it to the new one?
You need to log in first. This will ensure that the old password is correct. Then, use the Register commands. See the example (MainForm.cs) for the similar code, but the important bits are:
jc.OnRegisterInfo += new jabber.client.RegisterInfoHandler(jc_OnRegisterInfo);
jc.OnRegistered += new jabber.client.IQHandler(jc_OnRegistered);
jc.Password = "New Password";
jc.Register(new JID(jc.User, jc.Server, null));
// Called back when server sends registration form
private bool jc_OnRegisterInfo(object sender, Register r)
{
if (r.Form == null)
return true;
// Some newer servers may use XData for registration
muzzle.XDataForm f = new muzzle.XDataForm(r.Form);
if (f.ShowDialog() != DialogResult.OK)
return false;
f.FillInResponse(r.Form);
return true;
}
// Done setting password
private void jc_OnRegistered(object sender, IQ iq)
{
}