candy-plugins icon indicating copy to clipboard operation
candy-plugins copied to clipboard

Plugin for Changing Password

Open the-solipsist opened this issue 11 years ago • 8 comments
trafficstars

It would be useful to have a Candy plugin that allows a user to change their XMPP password via a web interface.

Currently I'm creating accounts for them with a default password, but would like to provide the ability to change their password.

the-solipsist avatar Jun 07 '14 04:06 the-solipsist

Is there anything that one can do to help this along?

the-solipsist avatar Jul 18 '14 00:07 the-solipsist

You could write the plugin yourself, or contract someone to write it for you :)

benlangfeld avatar Jul 18 '14 00:07 benlangfeld

Thanks. Unfortunately, I'm not a coder, and am looking to get this set up for a loose collective. Guess I'll just wait to see if someone takes interest in it.

the-solipsist avatar Aug 05 '14 22:08 the-solipsist

You could always learn. ;)

malakada avatar Aug 05 '14 22:08 malakada

@melissanoelle I'd love to. Would looking at https://github.com/candy-chat/candy-plugins/blob/master/createroom/createroom.js be a good place to start?

How do I find out what the "Candy.Core.Action.Jabber.Room.Join(roomJid, null)"-equivalent for changing the password should be? I searched through the "candy" repository for "password" and here's what I see: https://github.com/candy-chat/candy/search?q=password

But given my non-existent knowledge of JS, going through core.js and core/event.js doesn't seem to provide me an answer. :-/

the-solipsist avatar Aug 05 '14 22:08 the-solipsist

That's the spirit! :+1:

Mmm, maybe, yeah. For this, you'd want something that pops up a modal (which CreateRoom does), and then has a form, and then something to handle the form.

For changing the password, you'll probably want to look at what stanza the XMPP server is expecting you to send to change it. Having a read through something like this might help: http://xmpp.org/extensions/xep-0077.html#usecases-changepw

You'd next want to look at one of the plugins that does something like Candy.Core.getConnection().$iq(...) because you'll use that to build your iq type message XML stanza to send to the server. (I really need to update my plugins, I am behind, so I'm not sure which one would be best to look at off the top of my head.)

Because Candy is built on top of Strophe.js, having a read through their docs will be helpful in understanding the $iq method, which is really what Candy.Core.getConnection() is a wrapper for.

Once you understand the idea of sending and receiving these XML stanzas back and forth between your client and your server, you could probably knock this out relatively quickly. :+1:

malakada avatar Aug 05 '14 22:08 malakada

@melissanoelle: Thanks so much. I'll try and get to this over the weekend.

I'm using Prosody, and they have a very helpful community chatroom. I'll ask there if they can tell me about the correct IQ stanza that needs to be sent. After that, I'll check some existing plugins and see if I can put something together that might work. (I don't know any Javascript, so that might be a bit of an impediment, but I'll try.) Once I have that, I'll share it here for comments.

the-solipsist avatar Aug 05 '14 23:08 the-solipsist

The proper spec you're looking for is XEP-0077: In-Band Registration. Examples are contained therein. The example in the spec would be built and sent like this:

var pwChangeRequest = $iq({
  type: 'set',
  to: 'shakespeare.lit'
})
.c('query', {xmlns: 'jabber:iq:register'})
.c('username').t('bill').up()
.c('password').t('newpass');

Candy.Core.getConnection().sendIQ(
  pwChangeRequest,
  function () {
    console.log("Password change was successful.")
  },
  function (responseStanza) {
    console.log("Password change failed.");
    console.log(responseStanza);
  }
);

benlangfeld avatar Aug 06 '14 00:08 benlangfeld