Page 1 of 1

Force Login

Posted: 28 Sep 2009, 18:02
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://www.smartfoxserver.com/forums/viewtopic.php?t=5841&highlight= but could never find the docs for it.

Posted: 28 Sep 2009, 21:13
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

Luck

Posted: 05 Oct 2009, 14:30
by matrix211v1
Any luck on this front?

Posted: 08 Oct 2009, 14:25
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

Exactly

Posted: 08 Oct 2009, 14:32
by matrix211v1
Looks exactly like what I needed, thanks!

Posted: 17 Nov 2009, 10:55
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).

Posted: 17 Nov 2009, 10:57
by ThomasLund
Its an extension you have to code yourself!

/Thomas

Posted: 17 Nov 2009, 12:29
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?

Posted: 17 Nov 2009, 12:37
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

Posted: 17 Nov 2009, 13:49
by kaligus
Yes... but how I make this work? :lol:

Posted: 18 Nov 2009, 05:36
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. ;)

Posted: 18 Nov 2009, 09:12
by kaligus
Thanks man, I will try this.

:D

Follow Up

Posted: 04 Dec 2009, 19:18
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/index.htm?http://www.smartfoxserver.com/docs/docPages/tutorials_pro/05_loginExt/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!

Posted: 27 Oct 2011, 13:27
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.