login name bad word filter happens after USER_LOGIN event

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

Moderators: Lapo, Bax

777666
Posts: 21
Joined: 17 Apr 2015, 02:58

login name bad word filter happens after USER_LOGIN event

Postby 777666 » 20 May 2015, 03:08

first of all, this is a sfs 2.x server side SFSEventType.USER_LOGIN issue. if i am on the wrong section plz move this post to the right spot.

here is my question:
I noticed my word filter works, but it happens after SFSEventType.USER_LOGIN event.
what i need to do is, at my login event, a new user will be created at database if the username doesn't exist. inorder to do that, i need this word filter to be applied before everything else where I find the system does word filter after my user creation process (it created user information at database, and then throw a bad word warning/error)
hence, i would like to know if there is a way to move the word filter before what happens inside USER_LOGIN event.

for example:
addEventHandler(SFSEventType.USER_LOGIN, TESTLOGIN.class);

public class TESTLOGIN extends BaseServerEventHandler {

@Override
public void handleServerEvent(ISFSEvent event) throws SFSException {
< I need word filter before this event or happens at very first line of this event so I don't insert anything into my database >
}
}
User avatar
Lapo
Site Admin
Posts: 22999
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: login name bad word filter happens after USER_LOGIN even

Postby Lapo » 20 May 2015, 07:18

Hi,
I have moved the post in the right forum section.

The USER_LOGIN is positioned at the very top of the chain of operations that are executed at login time by the server.
It passes the control to the developer to check the user credentials and then proceeds with the other checks, including the bad words filter.

In order to store the new User in the database you should probably use the USER_JOIN_ZONE event, which is executed at the end of the login chain, instead.

When the User finally joins the Zone all tests were passed correctly, not only the bad words filter but also the test for banned users, duplicate names and so on... that's the right moment to finally store the new client in the DB.

What you can do in the USER_LOGIN is check if the user exist:
- if it does you go ahead and check the credentials...
- otherwise you can mark it as "new", for example by storing a specific flag into the Session object, which will be given back to you in the USER_JOIN_ZONE event.

Makes sense?
Lapo
--
gotoAndPlay()
...addicted to flash games
777666
Posts: 21
Joined: 17 Apr 2015, 02:58

Re: login name bad word filter happens after USER_LOGIN even

Postby 777666 » 20 May 2015, 07:29

thank you very much. i will move my code to user join zone section.

Return to “SFS2X Questions”

Who is online

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