How to get status of login

Post here your questions about the HTML5 / JavaScript for SFS2X

Moderators: Lapo, Bax

Post Reply
Riotlove
Posts: 35
Joined: 28 Jan 2024, 00:30

How to get status of login

Post by Riotlove »

I want to find out the status of the login after its sent, like if it successed or not.

var params = new SFS2X.SFSObject();
if (login_type == "signup") {
params.putUtfString("username", username);
params.putInt("age", parseInt(age));
params.putUtfString("role", role);
}

params.putUtfString("login_type", login_type);
sfs.send(new SFS2X.LoginRequest(email, password, params, zoneName));
User avatar
Lapo
Site Admin
Posts: 23438
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: How to get status of login

Post by Lapo »

Hi,
you have two client side events to handle the login request:
SFSEvent.LOGIN
SFSEvent.LOGIN_ERROR

The latter will report errors such as: incorrect credentials, Zone full, and more...
The error messages and codes are documented here:
https://docs2x.smartfoxserver.com/Advan ... r-messages

Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Riotlove
Posts: 35
Joined: 28 Jan 2024, 00:30

Re: How to get status of login

Post by Riotlove »

ty!! im stupid haha
Post Reply