XMPP For The Web/Win ::: XMPP-FTW (1.18.0) Flattr this

XEP-0077 In-Band Registration

Get registration information

        socket.send(
            'xmpp.register.get',
            { 
                "to": "evilprofessor.co.uk"
            },
            function(error, data) { console.log(error, data) }
        )
        

Example response:

        {
          instructions: 'Please provider username, email, password',
          email: true,
          username: true,
          password: true
        }
        

Registration information can also be returned with a data form which will be provided under the form key.

For an already registered entity the response may look like this:

        {
            email: 'lloyd@evilprofessor.co.uk',
            username: 'lloydwatkin',
            password: 'xmpp-ftw-password',
            registered: true
        }
        

Finally registration infomration may be provided 'out of band' via XEP-0066 support. This information (if provided) would be held in the oob key

Register

One you are ready to register then registration can be performed with data matching that from xmpp.register.get information.

        socket.send(
            'xmpp.register.set',
            {
                "to": "evilprofessor.co.uk",
             /* "email": "lloyd@evilprofessor.co.uk", */
             /* "username": "lloydwatkin",            */
             /* "password": "xmpp-ftw-password",      */
             /* "form": [ ]                           */
            },
            function(error, data) { console.log(error, data) }
        )
        

All data, other than to here is optional as it depends on the information requested by the service. Data forms can be passed back using the standard xmpp-ftw format (with FORM_TYPE field not required).

A successful request will result in the data argument having a property of registered which will equal true.

Unregister

It is possible to unregister from an entity as follows:

        socket.send(
            'xmpp.register.unregister',
            {
                "to": "evilprofessor.co.uk",
             /* "form": [] */
            },
            function(error, data) { console.log(error, data) }
        )
        

Should unregistering succeed then the data argument will simply be true. However if unregistering fails it may include a data form to be submitted in order to unregister as follows:

        {
            type: "cancel",
            condition: "not-allowed",
            form: {
                /* ... standard data form ... */
            }
        }
        

In order to complete unregistering process make the same xmpp.register.unregister again with the form parameter completed.

Changing password

Passwords can be changed as follows:

        socket.send(
            'xmpp.register.password',
            {
                "to": "evilprofessor.co.uk",
             /* "username": "lloydwatkin", */
             /* "password": "xmpp-ftw-password", */
             /* "form": [] */
            },
            function(error, data) { console.log(error, data) }
        )
        

A successful response will come back as follows:

        { registered: true }
        

Errors can potentially include a data form with instructions on what data is required for a successful password change.

        {
            type: "cancel",
            condition: "not-allowed",
            form: {
                /* ... standard data form ... */
            }   
        }   
        

For example with prosody to successfully change a password the following payload will work (logged in as lloyd@evilprofessor.co.uk:

        {
            "to": "evilprofessor.co.uk",
            "username": "lloyd",
            "password": "my-new-password"
        }
        

Out of band data

Should the server request that any stage of registering, unregistering, or changing password take place "Out of Band" (e.g. via a web page) then this data will be provided in a oob property of the data response.

Pages

Fork me on GitHub