Default Username Login Behaviour Issue

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Default Username Login Behaviour Issue

Postby NM » 21 Feb 2012, 20:40

Hi, I was planning to just use the standard login procedure for a game I'm making. I wanted to allow the user to enter their name and login without password.

The problem is that when a user logs in with the same username as someone who is already logged in, the logged in user is disconnected.

To solve this problem I tried using a FindUsersRequest to see if a user exists with the same username before logging in. But this isn't possible as the user isn't logged in yet - the request fails.

What's the best way of checking that a username is unique before login using the standard logging in system?

Cheers
Cheers, NM
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: Default Username Login Behaviour Issue

Postby NM » 21 Feb 2012, 20:49

I could auto login as a guest and then do the 'actual' user login after - so I can make FindUsersRequests in the login section. But this seems like a silly way of doing it.
Cheers, NM
appels
Posts: 464
Joined: 28 Jul 2010, 02:12
Contact:

Re: Default Username Login Behaviour Issue

Postby appels » 22 Feb 2012, 07:21

It's the only way to make it work. Registration systems need to be done in the same way.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: Default Username Login Behaviour Issue

Postby Bax » 22 Feb 2012, 08:39

NM wrote:Hi, I was planning to just use the standard login procedure for a game I'm making. I wanted to allow the user to enter their name and login without password.

The problem is that when a user logs in with the same username as someone who is already logged in, the logged in user is disconnected.

To solve this problem I tried using a FindUsersRequest to see if a user exists with the same username before logging in. But this isn't possible as the user isn't logged in yet - the request fails.

What's the best way of checking that a username is unique before login using the standard logging in system?

Cheers

Unless you set the "force logout" to true in the Zone configuration, a user with the same name of another one already logged won't be able to login.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X Questions”

Who is online

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