conversejs / converse.js

Web-based XMPP/Jabber chat client written in JavaScript
http://conversejs.org
Mozilla Public License 2.0
3.08k stars 771 forks source link

Unable to register a new user to ejabberd 2.1.11 #370

Closed themoonraker13 closed 9 years ago

themoonraker13 commented 9 years ago

I'm unable to register user to ejabberd server (residing on cloud) from converse client. I'm able to chat with existing users but unable to register new ones.

The same (chatting and registration) is possible via other xmpp clients like pidgin and so.

jcbrand commented 9 years ago

Can you give the details of the server so that I can try it out?

themoonraker13 commented 9 years ago

Server Domain: codester.cloudapp.net

Registering a new user to the server results in an error: bad request

jcbrand commented 9 years ago

Do you have access to that server's logs? They should give you an indication why ejabberd is not happy with the request.

jcbrand commented 9 years ago

I tried it out and get the same result as you. Registration works with other XMPP servers, so I'm not sure if this problem lies with converse.js or your server.

themoonraker13 commented 9 years ago

Well let me check out the logs. Registration for a new user is successfully made via other clients so I guess server shall be working fine. But still let me go into the roots of the problem and let you know if at all I find anything.

themoonraker13 commented 9 years ago

I'went through the server logs but no entries are made into the logs when I try to register from conversejs client unlike other clients where log entry for a new user registration is made.

The following error message is shown when I try registering using conversejs: "The provider rejected your registration attempt. Please check the values you entered for correctness. bad-request "

ejabberd reg log

Here in the log 'john' is the demo user I tried to add using other xmpp client (pidgin) but then when I tried it using conversejs no entry in the log was made and I got a bad request error.

jcbrand commented 9 years ago

I looked at what stanzas Pidgin sends and at what converse.js sends.

Pidgin:

<iq type='set' id='purple8d526d54' to='codester.cloudapp.net'>
    <query xmlns='jabber:iq:register'>
        <username>testing370</username>
        <password>xxxxx</password>
    </query>
</iq>

Converse.js

<iq type="set" xmlns="jabber:client">
    <query xmlns="jabber:iq:register">
        <x xmlns="jabber:x:data" type="submit">
            <field xmlns="http://www.w3.org/1999/xhtml" var="username">
                <value>testingagain370</value>
            </field>
            <field xmlns="http://www.w3.org/1999/xhtml" var="password">
               <value>xxxxxx</value>
           </field>
       </x>
    </query>
</iq>

Seems like your server doesn't support xform data during registration. I'll have to do some more investigation on this later.

themoonraker13 commented 9 years ago

Thanks for continuous feedback on the issue. Hoping to use conversejs in my application if things get better in near future.

gstammw commented 9 years ago

I'm having the very same problem. Isn't there a workaround available?

knixeur commented 9 years ago

I think that servers are not forced to support xform, http://xmpp.org/extensions/xep-0077.html#extensibility Maybe adding FORM_TYPE value could help with ejabberd, I'll try to check this if I've some time

knixeur commented 9 years ago

Doing a quick check I saw that there's already some legacy/xform handling during registration, however it's used when submitting based on the data built by submitRegistrationForm which is always xform. I guess when calling renderRegistrationForm the form_type variable should be set to xform/legacy accordingly to then send the data in the expected format.

PS: Created two tests, the form_type is correctly set so far as it's called from onRegistrationFields before renderRegistrationForm. Still missing to test if it sends the data accordingly

knixeur commented 9 years ago

The problem was finally that submitRegistrationForm didn't care if it was legacy or xform, it always sent xform data. I've added code to make allow it to send as legacy and extended the tests I previously wrote to also check that.

PS: Heads up, I could create an account in the server, however, if I sent a full jid in the username field (ie: test@codester.cloudapp.net) it would faild with a bad request, it only accepts plain username (ie: test)

jcbrand commented 9 years ago

Heads up, I could create an account in the server, however, if I sent a full jid in the username field (ie: test@codester.cloudapp.net) it would faild with a bad request, it only accepts plain username (ie: test)

The "username" field should show the domain so that it's clear that you don't have to type it. This was not the case for the legacy form, which is fixed now after this commit: https://github.com/jcbrand/converse.js/commit/6dc355a02ab940917908205db34a23eebb0b340e

themoonraker13 commented 9 years ago

I'm still unable to register a new user after fetching the registration form using my server's domain (i.e. codester.cloudapp.net). After fetching the registration form I tried registering a user by simply filling in username (without @server_name) and password but the conversejs client replies with a bad request message.

jcbrand commented 9 years ago

@themoonraker13 where and how are you trying this?

themoonraker13 commented 9 years ago

I'm trying to register a new user from the main page of : https://conversejs.org/ The registration request fails with a bad request error.

jcbrand commented 9 years ago

Sorry, I forgot to make a minified build for the website. Should now be working there. BTW, make sure to clear your browser cache before you try again.

themoonraker13 commented 9 years ago

Things are working well now from the conversejs website. But, still I'm not able to do the same from my website (I've cloned the conversejs github repo into my project).

jcbrand commented 9 years ago

you should run make dev build first.

themoonraker13 commented 9 years ago

Thanks a lot for the continuous feedback and support.

themoonraker13 commented 9 years ago

Unable to run the command: returns an error untitled

I'm using windows os for development purpose and I ran the following command: make -f Makefile.win dev build

jcbrand commented 9 years ago

@themoonraker13 Please don't post unrelated problems to closed tickets.

See these tickets: https://github.com/jcbrand/converse.js/issues/379 https://github.com/jcbrand/converse.js/issues/381

themoonraker13 commented 9 years ago

Apologies for the same. Lost my senses over there.