By default APE comes with a module that manages nicknames. This module might
interfere with whatever mechanism you plan to use. Look at
scripts/examples/nickname.js. Notice that it hooks into the CONNECT command.
If you want to remove this default behavior then uncomment it from
scripts/main.ape.js. You can also use this module for inspiration.
When the client calls client.core.start(params), the CONNECT hook receives
whatever is passed into the client.core.start() function. Let's say the call
is client.core.start({user: "bob", pass: "123"}), then inside your CONNECT
hook you can do something like the following:
Ape.registerHookCmd("connect", function(params, cmd) {
if params.user is valid && params.pass is valid {
return 1;
} else {
return ["001", "INVALID LOGIN"];
}
})
On Fri, Nov 26, 2010 at 6:58 AM, Shashwat <[email protected]> wrote:
> Hey,
>
> I am a novice and have recently started using ape. I want to setup a
> user authentication system as soon as a new user connects to the ape
> server. I want to integrate it with MySQL. I have checked out APE
> Server documentation. Just need a little help to get started. So far I
> have figured out this much.
> -> Use load() and core.start() to connect to ape.
> -> When the user enters username and password, pass this to ape server
> via (probably) CONNECT command(not sure what exactly to do).
> -> Use registerHookCmd to create a hook for CONNECT function.
> -> use MySQL connection class (http://www.ape-project.org/docs/server/
> mysql/mysql.html<http://www.ape-project.org/docs/server/%0Amysql/mysql.html>)
> inside this hook and do the needful authentication.
> -> now when CONNECT command is invoked this hook will be called and on
> successful authentication via MySQL set some additional user
> properties, if authentication fails then return false and user won't
> be created.
>
> Is this correct? What is this CONNECT command and how to use it? Do I
> have to pass parameters here and use them in my custom hook? Or do I
> create a new server side command use it instead for authentication?
> And if the authentication is successful then how do I create/add a new
> user? Is there an example somewhere apart from
> http://www.ape-project.org/wiki/index.php/Serverside_js_module_using_MySQL
> that can prove to be helpful?
>
> --
> You received this message because you are subscribed to the Google
> Groups "APE Project" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<ape-project%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/ape-project?hl=en
> ---
> APE Project (Ajax Push Engine)
> Official website : http://www.ape-project.org/
> Git Hub : http://github.com/APE-Project/
>
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/