Creating custom login and registration

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

XaeroDegreaz
Posts: 26
Joined: 23 Nov 2007, 03:47

Creating custom login and registration

Postby XaeroDegreaz » 06 Dec 2007, 08:27

OK, I finally got the MySQL driver to work. I want to make everything integrated into SFS. I'd been using loadVars and AMFPHP to do all of the logging in and registration to the MySQL database, and in return if the query was successful, then send the login command to SFS.

What I want to do now is cut out the middle man. Is there a way to perform a "login" or "registration" query without the client being in a room?

I mean, the client is automatically connected to the server, and joins a zone immediately. Then a login screen pops up. From that login screen I want to interact with a server side extension, but the problem comes when I want to return stuff to the client. Since the client has no username, how do I send data back to him like "Congrats, you are registered!" or "Login failed"?

I think once that question is answered I'll be in business and completely independent of using anything else besides the sockets to make queries happen.

Here is kinda a scheme I'm trying to achieve:

Zone > Login Screen > Extension login/register script > Back to client letting him/her know the results.

Thanks in advance!
XaeroDegreaz
Posts: 26
Joined: 23 Nov 2007, 03:47

Postby XaeroDegreaz » 06 Dec 2007, 08:37

Man, I always happen to find the answer I'm looking for just after I post a question relating to it :(

Oh well. For anyone else wondering about this, check the documentation under:

Server API for ActionScript, and the the loginUser() function.

I passed over that one several times, thinking it was for something else. But lo and behold I got desperate and it happened to be what I was looking for!
XaeroDegreaz
Posts: 26
Joined: 23 Nov 2007, 03:47

Postby XaeroDegreaz » 06 Dec 2007, 16:02

It seems I may have jumped the gun. I now have the login working very very well, but, how would one use the same technique to make a registration feature?

I don't see an internalEvent for registration. Is there a way to kinda create one?

Then I can kinda re-use the login code I think.

Otherwise, I can have an external script do the login -_- which really defeats the purpose of what I'm trying to do.
patso
Posts: 380
Joined: 13 Nov 2006, 13:44
Location: Sofia, Bulgaria

Postby patso » 06 Dec 2007, 18:19

I think it's better to use external sever side script (PHP for example) or J2EE servlet for the registration - it's much more flexible by my opinion. Since you use database you should not have problem with the fact that the registration is outside SFS and the login is inside.

But if you choose the hard way:
* Login the user with guest name
* Join it to limbo room.
* After that use room extension attached to the limbo room to complete the registration process.
* Disconnect the user and display the login box or directly connect him using the user name and password that he/she provide.
XaeroDegreaz
Posts: 26
Joined: 23 Nov 2007, 03:47

Postby XaeroDegreaz » 07 Dec 2007, 04:20

Heheh yeah I had thought of that hard way.

Thing is, I'm really wanting to make everything run straight through SFS by eliminating the middle man.

Perhaps I'll just go the easy way. Seems more practical. But sure would be nice for in the next version for them to add some sort of functionality for registration, eliminating all of that limbo room stuff :P

Thanks Patso.
User avatar
Lapo
Site Admin
Posts: 23007
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 07 Dec 2007, 08:20

Zone > Login Screen > Extension login/register script > Back to client letting him/her know the results.


This is almost correct!
By default the server doesn't accept any request unless the user is joined to a room. (security! security!! :) )

Simply add a Limbo type Room in your zone definition: join the wanna-register user -> fill the form -> check data -> end of story.

You can also send him a confirmation email using the appropriate mail functions provided with SFS

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 19 guests