User name case sensitivity

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

Moderators: Lapo, Bax

tpenn
Posts: 95
Joined: 03 Aug 2010, 18:48

User name case sensitivity

Postby tpenn » 27 Jan 2011, 16:23

As I understand it, user names in SFS2x are case sensitive; Bob is different from bob.

I would really like to be able to treat user names as case insensitive. I realize I can do quite a bit already; not allow bob to login if Bob is already logged in, for example. However, there are a number of problems I've run into.

My biggest problem is looking up a user by name if I don't have the right case, a situation I'm running into in some of my request handlers. Both SFSApi.getUserByName and Zone.getUserByName are case sensitive (and understandably so, since the system is). SFSApi.findUsers isn't any help; StringMatch has no case insenstive option, either.

Is there any support planned in this area, or am I pretty much on my own here?

Short of iterating through all the users in the zone and checking user.getName().equalsIgnoreCase(name), does anyone have any other suggestions?
tchen
Posts: 191
Joined: 11 Dec 2010, 14:14

Postby tchen » 27 Jan 2011, 20:28

One possible thing to do is to transform all login names into lower or upper case during the login process and store their submitted name as a user variable. You might lose out on some buddy/client referencing though if you go this route.
User avatar
Lapo
Site Admin
Posts: 21639
Joined: 21 Mar 2005, 09:50
Location: Italy

Postby Lapo » 28 Jan 2011, 09:12

tchen has a good point. As regards buddies I think it could work too. Buddies support a nickname. So the buddy-name is the User name and the nickname can be the other case-insensitive version of the name.
Lapo
--
gotoAndPlay()
...addicted to flash games
NM
Posts: 20
Joined: 28 Nov 2011, 01:26

Re: User name case sensitivity

Postby NM » 21 Feb 2012, 23:48

BUMP,

I'm having this problem. As this is over a year old and there have been many changes since - is there now a way to do case insensitive searches for users?

I would like to be able to stop users having similar names like 'ken' and 'Ken'. The solution suggested here isn't ideal, I hope someone has a better solution.

Cheers
Cheers, NM
User avatar
Lapo
Site Admin
Posts: 21639
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: User name case sensitivity

Postby Lapo » 22 Feb 2012, 09:28

There haven't been any changes, the rule is the same where BOB != Bob != bob != BoB etc...
The problem is outside the server. If you don't want two users with the same name you should implement this at the registration level. In other words when a User registers an account (which presumably will be stored in a DB) you check that the name isn't already taken and if its you prompt the User to use another name.
Lapo

--

gotoAndPlay()

...addicted to flash games
ccollomb
Posts: 11
Joined: 14 May 2012, 22:34

Re: User name case sensitivity

Postby ccollomb » 22 May 2012, 21:00

We are running into this problem today too. It is easy to solve that at registration level and login.

For example we allow BoB, and if anyone tries to login with a different capitalization it will not work. However, the problem is with the buddy finding.

When you add a Buddy you need to have the correct case, how do you propose to solve that?

Example username is AbCdEfGh and I would like to be able to add the correct unique user to my buddies with abcdefgh and still have the name displayed in buddy list with the right case AbCdEfGh to respect the intent of the player.
User avatar
Bax
Site Admin
Posts: 4522
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Re: User name case sensitivity

Postby Bax » 23 May 2012, 06:49

You could convert the user name to lowercase at login, and save the name with the right capitalization in a user variable, to be displayed in the game. When it comes to the buddy list, you just have to convert the name entered by the player to lowercase and add the buddy.
Paolo Bax
The SmartFoxServer Team

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 24 guests