Switch branches/tags
Nothing to show
Find file History
Pull request Compare This branch is 321 commits behind metajack:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
..
Failed to load latest commit information.
README.md
strophe.register.js

README.md

strophe.register.js

A Strophe Plugin for In-Band Registration.

Usage

Just link the register plugin below the strophe library in your HTML head section:

<head>
<!-- ... -->
<script type="text/javascript" src="strophe.min.js"></script>
<script type="text/javascript" src="strophe.register.js"></script>
<!-- ... -->
</head>

Before you connect:

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.register.authenticate();
    } else if (status === Strophe.Status.CONNECTED) {
        console.log("logged in!");
    } else {
        // every other status a connection.connect would receive
    }
};
connection.register.connect("example.com", callback, wait, hold);

After that you're logged in with a fresh smelling jid.