Create new user with custom login

Post here your questions about the Unity / .Net / Mono / Windows 8 / Windows Phone 8 API for SFS2X

Moderators: Lapo, Bax

nikolaiko
Posts: 13
Joined: 30 Mar 2011, 10:40

Create new user with custom login

Postby nikolaiko » 22 Mar 2013, 09:40

Hi, I am sorry if I am asking something that is already answered, but I didn't found any information about this. I planing to create a game using smartfoxserver on server side. So then user opens game for the first time it will see menu with text fields for the new login and password. After that he will press, Register and game should create a record in db with entered login-pass. And login user to the Zone. After that he will directed to the first Room of the game zone... The question is how to create new users? Because client can't send any request to extension until he is not logged to it?

Or maybe this kind of functionality implemented in some other ways?

Thanks.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Create new user with custom login

Postby rjgtav » 23 Mar 2013, 13:40

Hello,

Yes, you can only send custom ExtensionRequests to an extension after a successful login, so you have 2 options:

1. Use 2 different zones, one for registration and the other for the game. On the registration you can send a login request with empty username and password and the registration data on the extra parameters object (the 4th parameter of the LoginRequest).

2. Another way is to use a single zone, and then the server-side extension decides whether to login or register the user with the provided info. This option is great for applications that use a login from an outside service, like facebook, where the user is already authenticated and just needs to enter the app.

Hope this helps
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Create new user with custom login

Postby Lapo » 24 Mar 2013, 20:26

There is another way to do this.

Allow the client to login as a guest user (temp name, no password), and apply to this user a specific user profile (e.g. the default Guest profile), let the user register his new account, logout the client and login him again with his new credentials (you can do this automatically) and voilà.

Guests and registered users will use different User privileges, therefore you can make sure that guests can only access a limited portion of the application (e.g. the register screen).

More on User privileges:
http://docs2x.smartfoxserver.com/Advanc ... ge-manager

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
nikolaiko
Posts: 13
Joined: 30 Mar 2011, 10:40

Re: Create new user with custom login

Postby nikolaiko » 25 Mar 2013, 08:37

Thank you you, for answers. As for me I started to think about first way by rjgtav with two different zones. But now I will study the way by Lapo and make decide. Thank You, guys.
anniyan137
Posts: 25
Joined: 20 Nov 2012, 10:49

Re: Create new user with custom login

Postby anniyan137 » 17 Apr 2013, 10:33

I'm doing something very similar to what you want to do. I use PHP scripts on my server that will handle the entire registration/login process and just login to the zone after the result of the authentication is obtained.

This lets me deal with 3 different methods of logging into the game.

    Facebook based
    Website based(for browsers)
    Guest login

Simple and straight forward. At least on the SFS side.

I still want to hear about what Lapo has to say about this method.
User avatar
Lapo
Site Admin
Posts: 23026
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Create new user with custom login

Postby Lapo » 17 Apr 2013, 12:37

Hi,
I think it makes sense, especially because this way you catch three birds with a stone :)
Lapo

--

gotoAndPlay()

...addicted to flash games
anniyan137
Posts: 25
Joined: 20 Nov 2012, 10:49

Re: Create new user with custom login

Postby anniyan137 » 18 Apr 2013, 06:09

Lapo wrote:Hi,
I think it makes sense, especially because this way you catch three birds with a stone :)


That I do. :D

Return to “SFS2X C# API”

Who is online

Users browsing this forum: Google [Bot] and 18 guests