Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OS X ejabberd, New user register by XMPPFramework

I'm new for ejabberd. I want to add new user on server through my iOS App. I tried with many code that was find out from the Google but no one can solve my issue.

I set module to http://localhost:5280/admin/server/localhost/node/ejabberd@localhost/modules/

enter image description here For enable mod_register also change ejabberd.yml file from etc/ejabberd folder.

enter image description here

And my Listened Ports at ejabberd@localhost

enter image description here

And I used below code for register user.

NSXMLElement *query = [NSXMLElement elementWithName:@"query" xmlns:@"jabber:iq:register"];
        [query addChild:[NSXMLElement elementWithName:@"username" stringValue:@"syam"]];
        [query addChild:[NSXMLElement elementWithName:@"password" stringValue:@"Vrin@123"]];
        NSXMLElement *iq = [NSXMLElement elementWithName:@"iq"];
        [iq addAttributeWithName:@"type" stringValue:@"set"];
        [iq addAttributeWithName:@"id" stringValue:@"reg2"];
        [iq addChild:query];
        [APP_DELEGATE.xmppStream sendElement:iq];

        [APP_DELEGATE.xmppStream setHostName:@"0.0.0.0"];
        [APP_DELEGATE.xmppStream setHostPort:5222];
        NSError *error;
        if (![APP_DELEGATE.xmppStream connectWithTimeout:XMPPStreamTimeoutNone error:&error]) {
            UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Error connecting"
                                                                message:@"See console for error details."
                                                               delegate:nil
                                                      cancelButtonTitle:@"Ok"
                                                      otherButtonTitles:nil];
            [alertView show];
        }

But didn't get success and occurred below error message.

<iq xmlns="jabber:client" from="himanshu@localhost" to="himanshu@localhost/15505992182228745748626" type="error" id="reg2"><query xmlns="jabber:iq:register"><username>syam</username><password>Vrin@123</password></query><error code="503" type="cancel"><service-unavailable xmlns="urn:ietf:params:xml:ns:xmpp-stanzas"></service-unavailable><text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">No module is handling this query</text></error></iq>

Please help me to solve my issue.

like image 355
iPatel Avatar asked Aug 29 '16 07:08

iPatel


1 Answers

access: register means - only already registered users are able to access mod_register (to change password, for example). You need to have access: all to allow registration. And do not forget to protect registration with CAPTCHA when server will be opened for public network (and in this case that simple registration implementation in XMPPFramework will not enough)

Also it's not clear is mod_register enabled for your virtualhost, check mod_register presence in modules: block of your configuration

like image 159
vitalyster Avatar answered Sep 29 '22 13:09

vitalyster