Force Login

Post here all your questions related with SmartFoxServer .Net/Unity3D API

Moderators: Lapo, Bax

Post Reply
matrix211v1
Posts: 61
Joined: 16 Jan 2009, 14:48

Force Login

Post by matrix211v1 »

Is there a way to "Force Login" with the current Unity/SFS system? Sometimes I get booted and when I try to log back in, it tells me my username is already in use. My only recourse is to wait for the timeout (currently set to 1 hour) or restart SFS.

Lapo mentions something about it here http://forums.smartfoxserver.com/viewto ... highlight= but could never find the docs for it.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Post by ThomasLund »

Hey

That one is new to me - and I just checked the 1.6.6 AS3 API and cannot find any reference to it either there.

Marco - can you help a bit on this one?

/Thomas
matrix211v1
Posts: 61
Joined: 16 Jan 2009, 14:48

Luck

Post by matrix211v1 »

Any luck on this front?
mistermind
Posts: 131
Joined: 15 Sep 2007, 01:33
Contact:

Post by mistermind »

Custom Login can handle that.
Set your zone's custom login to true:

Code: Select all

<Zone name="Server" uCountUpdate="false" maxUsers="1000" customLogin="true">
And use an extension to handle login using the loginRequest event on handleInternalEvent. From there you can use the loginUser method:

Code: Select all

_server.loginUser(nick, pass, channel, forceLogin)
Witch allows you to force a login. You can read more about custom login here:
http://www.smartfoxserver.com/docs/docP ... /index.htm
SELECT * FROM users WHERE clue > 0
0 rows returned.
matrix211v1
Posts: 61
Joined: 16 Jan 2009, 14:48

Exactly

Post by matrix211v1 »

Looks exactly like what I needed, thanks!
kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Post by kaligus »

mistermind wrote:Custom Login can handle that.
Set your zone's custom login to true:

Code: Select all

<Zone name="Server" uCountUpdate="false" maxUsers="1000" customLogin="true">
And use an extension to handle login using the loginRequest event on handleInternalEvent. From there you can use the loginUser method:

Code: Select all

_server.loginUser(nick, pass, channel, forceLogin)
Witch allows you to force a login. You can read more about custom login here:
http://www.smartfoxserver.com/docs/docP ... /index.htm
Please friend, how can I active this? I tried here and returns me nothing, I just can't connect (and SFS say its an error in code).
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Post by ThomasLund »

Its an extension you have to code yourself!

/Thomas
kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Post by kaligus »

I know Thomas :lol:

I already code myself the Login extension... but the command "forceLogin" is a pré-defined into API?

I mean, I just put the forceLogin in there and nothing happens.
Or the "forceLogin" is a custom script?
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Post by ThomasLund »

Ahhh

The force login is on the server side API if I understood it - not the client API. If thats what you ask for :-)

/T
kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Post by kaligus »

Yes... but how I make this work? :lol:
cadamson
Posts: 19
Joined: 27 Sep 2009, 04:00

Post by cadamson »

Hi kaligus.

Just use the following statement server side:

Code: Select all

_server.loginUser(nick, pass, channel, true)
forceLogin is a boolean variable. ;)
kaligus
Posts: 45
Joined: 01 Sep 2009, 13:26

Post by kaligus »

Thanks man, I will try this.

:D
matrix211v1
Posts: 61
Joined: 16 Jan 2009, 14:48

Follow Up

Post by matrix211v1 »

Ok, I got my Extention calling the database, verifying that the user exist and is correct, and now I am returning to the client application.

OnEntentionResponse now fires. I can get the result.

Now what do I need to call in the client application? OnLogin?

Thanks for any and all help!

[EDIT]
I reread the directions located at http://www.smartfoxserver.com/docs/inde ... /index.htm so let me try calling the smartfox.getRoomList() and see if that gets my program to move along. I will post what I find soon.

[EDIT] Follow Up
Yes, calling smartfox.GetRoomList() in the UnityAPI continues you to login to your application. Hope this helps someone!
Rashomon
Posts: 72
Joined: 11 Aug 2010, 19:48

Post by Rashomon »

You can read more about custom login here:
http://www.smartfoxserver.com/docs/docP ... /index.htm
According to the above link:
Also the myUserName and myUserId properties ARE NOT populated auto-magically, so you will need to do it manually, if you need them.
Can someone give me some guidance on how to do this on the server?

I think I can get the user name from the string passed to the server from the smartfox.login client's call. How/where can I get the userID, though?

Once I get these values, can I attach them directly to the SmartFoxClient object, or will I have to attach them to another object? For example, I would like to still be able to access the user ID with smartFox.myUserId, rather than something like myObj.myUserId = myUserIdPassedFromServer.
Post Reply