I'm trying to register a new user on openfire server with the strophe plugin but it doesn't connect for the registration. The description here https://github.com/metajack/strophejs-plugins/tree/master/register doesn't bring me any further :( Do I have to establish a connection before? This is what I try when clicking a button to register:
$("#RegButton").click(function () {
var callback = function (status) {
if (status === Strophe.Status.REGISTER) {
connection.register.fields.username = "juliet";
connection.register.fields.password = "R0m30";
connection.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
console.log("registered!");
connection.authenticate();
} else if (status === Strophe.Status.CONNECTED) {
console.log("logged in!");
} else {
// every other status a connection.connect would receive
}
};
connection.register.connect("http://localhost:7070/http-bind/", callback);
});
On this line:
connection.register.connect("http://localhost:7070/http-bind/", callback);
connection
should be a Strophe.Connection object already created with your service URL ("http://localhost:7070/http-bind/"
).
The first parameter to connection.register.connect()
is the host that you want to register an account on. That is, for a JID of [email protected] you would set it to "example.com"
, not "http://localhost:7070/http-bind/"
as in your code.
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