节注册插件
Strophe register plugin
我正在尝试使用这个
https://github.com/strophe/strophejs-plugins/tree/master/register
对于我的小应用程序
总是得到 Strophe.status = 1?这是什么意思?进入If注册新用户应该是11
您可以根据我在 Plunker 上的示例验证您的代码:
http://plnkr.co/edit/F8cbsBZQUPiZ0W1v0O89
这里是用户注册相关的代码部分:
function register() {
var registerCallback = function (status) {
if (status === Strophe.Status.REGISTER) {
log("registerCallback: REGISTER");
connection.register.fields.username = $('#reg_name').get(0).value;
connection.register.fields.password = $('#reg_pass').get(0).value;
console.log(connection.register.fields);
connection.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
log("registerCallback: REGISTERED");
$('#jid').get(0).value = $('#reg_name').get(0).value + "@" + server;
$('#pass').get(0).value = $('#reg_pass').get(0).value;
connection.authenticate();
} else if (status === Strophe.Status.CONNECTED) {
log("registerCallback: CONNECTED");
// set presence
connection.send($pres());
updateConnButton(true);
} else if (status === Strophe.Status.CONFLICT) {
log("registerCallback: Contact already existed!");
} else if (status === Strophe.Status.NOTACCEPTABLE) {
log("registerCallback: Registration form not properly filled out.")
} else if (status === Strophe.Status.REGIFAIL) {
log("registerCallback: The Server does not support In-Band Registration")
} else {
// every other status a connection.connect would receive
}
};
if (!connection) {
var url = BOSH_SERVICE;
connection = new Strophe.Connection(url);
connection.rawInput = rawInput;
connection.rawOutput = rawOutput;
}
connection.register.connect(server, registerCallback);
}
我正在尝试使用这个 https://github.com/strophe/strophejs-plugins/tree/master/register 对于我的小应用程序
总是得到 Strophe.status = 1?这是什么意思?进入If注册新用户应该是11
您可以根据我在 Plunker 上的示例验证您的代码:
http://plnkr.co/edit/F8cbsBZQUPiZ0W1v0O89
这里是用户注册相关的代码部分:
function register() {
var registerCallback = function (status) {
if (status === Strophe.Status.REGISTER) {
log("registerCallback: REGISTER");
connection.register.fields.username = $('#reg_name').get(0).value;
connection.register.fields.password = $('#reg_pass').get(0).value;
console.log(connection.register.fields);
connection.register.submit();
} else if (status === Strophe.Status.REGISTERED) {
log("registerCallback: REGISTERED");
$('#jid').get(0).value = $('#reg_name').get(0).value + "@" + server;
$('#pass').get(0).value = $('#reg_pass').get(0).value;
connection.authenticate();
} else if (status === Strophe.Status.CONNECTED) {
log("registerCallback: CONNECTED");
// set presence
connection.send($pres());
updateConnButton(true);
} else if (status === Strophe.Status.CONFLICT) {
log("registerCallback: Contact already existed!");
} else if (status === Strophe.Status.NOTACCEPTABLE) {
log("registerCallback: Registration form not properly filled out.")
} else if (status === Strophe.Status.REGIFAIL) {
log("registerCallback: The Server does not support In-Band Registration")
} else {
// every other status a connection.connect would receive
}
};
if (!connection) {
var url = BOSH_SERVICE;
connection = new Strophe.Connection(url);
connection.rawInput = rawInput;
connection.rawOutput = rawOutput;
}
connection.register.connect(server, registerCallback);
}