HandshakeRequest manages and initialises a new remote session via the SessionInfo object.
Contents |
[edit] Constructor
new HandshakeRequest (user, handler, [password])
| Name | Type | Required | Description |
|---|---|---|---|
| user | String | Yes | Username, email or similar field used to pass to the authentication provider. |
| handler | String | Yes | Authentication provider on the server to use. Examples include 'store', 'openid', and so on. |
| Password | String | No | Either plain-text or hashed password to be passed to the authentication provider along with the username. Not required by all authentication providers. |
[edit] Properties
[edit] authSuccessful
Type: Function
Default: null
Function to run when the handshake has completed and run without fail. The function will be run with a single argument, the SessionInfo object for the newly created session.
[edit] authFailure
Type: Function
Default: null
Function to be run when the handshake failed on the server. This is generally not a web exception; use the requestFailure property for that purpose. This function will be called with two arguments, the error code, followed by the error message (en_US only). Please base internationalisable error messages off the error code, rather than the message returned; it should only be used for debugging/testing.
[edit] requestFailure
Type: Function
Default: null
Function to be run when the data query encounters an error. This can be assumed to be a web-related exception. The function will be called with the same arguments as run by MooTools's Request onFailure event. See http://docs12b.mootools.net/Request/Request#Request:events for more information.
[edit] Methods
[edit] run ()
Returns: nothing
Runs the current HandshakeRequest instance asynchronously. Calls authComplete when the user has been successfully authenticated and a new session created, and authFailure if there was an authentication error.
[edit] Example
var a = new HandshakeRequest ("rupert", "store", "mypassword");
a.authSuccessful = onAuthComplete;
a.run ();
