2012-05-02 8 views
4

openfireサーバーにstropheプラグインを使用して新しいユーザーを登録しようとしていますが、登録に接続しません。ここでの説明https://github.com/metajack/strophejs-plugins/tree/master/registerはそれ以上は:(私は前に接続を確立する必要がありますか私をもたらすものではありません。これは、登録するボタンをクリックしたときに、私がしようとするものである:?この行でXEP-0077 Strophe.jsとopenfireの使用による帯域内登録

$("#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); 
}); 

答えて

4

connection.register.connect("http://localhost:7070/http-bind/", callback); 

connectionは、すでにあなたのサービスのURL("http://localhost:7070/http-bind/")で作成したStrophe.Connectionオブジェクトでなければなりません。connection.register.connect()

最初のパラメータは、アカウントを登録したいホストでありますに。つまり、JIDがの場合、[email protected]に設定すると、コードでは"http://localhost:7070/http-bind/"ではなく"example.com"に設定されます。

4

私はプラグインを修正しました。ライン215の中で "if(register.length === 0)"は常に私の意図をレジスタで終了するので、これらの行をコメントして、 "x"タグを削除しました。私の連をもたらし、登録簿は明らかであった。 私はこれがあなたを助けてくれることを願っています。

/* 
     if (register.length === 0) { 
     console.log('En tra if de linea 220'); 
     //that._changeConnectStatus(Strophe.Status.REGIFAIL, null); 
     //return; 
    } else */ 
    this.enabled = true; 
+0

私もstrophe.register.jsと同じ問題があり、同じ行をコメントアウトして回避しました。私はXMPPサーバーとして韻律を使用しています。どのサーバーを使用していますか? – Ando

関連する問題