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/
For enable
mod_register
also change ejabberd.yml
file from etc/ejabberd
folder.
And my Listened Ports at ejabberd@localhost
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With