Force Login

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

Moderators: Lapo, Bax

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

Force Login

Postby matrix211v1 » 28 Sep 2009, 18:02

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.
ThomasLund
Posts: 1297
Joined: 14 Mar 2008, 07:52
Location: Sweden

Postby ThomasLund » 28 Sep 2009, 21:13

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

Postby matrix211v1 » 05 Oct 2009, 14:30

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

Postby mistermind » 08 Oct 2009, 14:25

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

Postby matrix211v1 » 08 Oct 2009, 14:32

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

Postby kaligus » 17 Nov 2009, 10:55

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

Postby ThomasLund » 17 Nov 2009, 10:57

Its an extension you have to code yourself!

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

Postby kaligus » 17 Nov 2009, 12:29

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

Postby ThomasLund » 17 Nov 2009, 12:37

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

Postby kaligus » 17 Nov 2009, 13:49

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

Postby cadamson » 18 Nov 2009, 05:36

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

Postby kaligus » 18 Nov 2009, 09:12

Thanks man, I will try this.

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

Follow Up

Postby matrix211v1 » 04 Dec 2009, 19:18

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!
Rashomon
Posts: 72
Joined: 11 Aug 2010, 19:48

Postby Rashomon » 27 Oct 2011, 13:27

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.

Return to “.Net / Unity3D API”

Who is online

Users browsing this forum: No registered users and 0 guests