// [Obsolete] // public User NewUser(Creds creds) // { // User client = new User(creds); // client.Settings.LOGIN_SERVER = creds.gridURL; // //@todo if creds.gridName not in Grids list add it // users.Add(client.sessionID, client); // return client; // } //create a new user and begin the login process public Guid BeginNewUserLogin(Creds creds) { //create the user object User client = new User(creds); //add the user to the list of users users.Add(client.sessionID, client); //initiate login client.BeginLogin(); return client.sessionID; }
// [Obsolete] // public User NewUser(Creds creds) // { // User client = new User(creds); // client.Settings.LOGIN_SERVER = creds.gridURL; // //@todo if creds.gridName not in Grids list add it // users.Add(client.sessionID, client); // return client; // } //create a new user and begin the login process public Guid BeginNewUserLogin(Creds creds) { //create the user object User client = new User(creds); //add the user to the list of users users.Add(client.sessionID, client); //initiate login client.BeginLogin(); return(client.sessionID); }
public UserMod() : base("/api") { //When the user requests to login Post["/login"] = parameters => { //parese their credentials Creds creds = this.Bind <Creds>(); //initiate login process Guid sessionID = ClientMgr.Instance.BeginNewUserLogin(creds); //tell them that we have started login Hashtable msg = new Hashtable(); msg.Add("status", "login begun"); msg.Add("sessionID", sessionID); return(msg); }; //when the user requests to logout Post["/logout"] = parameters => { //parse their logout credentials Logout logout = this.Bind <Logout>(); //we don't want users logging eachother out, xss so we need some sort of session ID if (ClientMgr.Instance.BeginLogout(logout.sessionID)) { //tell them that we have started logout Hashtable msg = new Hashtable(); msg.Add("status", "logout begun"); msg.Add("sessionID", logout.sessionID); return(msg); } else { Console.WriteLine("Unable to begin logout"); //tell them that we have FAILEDstarted login Hashtable msg = new Hashtable(); msg.Add("status", "logout FAILED"); msg.Add("sessionID", logout.sessionID); return(msg); } }; }
//@todo Instances of the client class should only be created by the ClientMgr public User(Creds creds) { Settings.ALWAYS_DECODE_OBJECTS = false; Settings.ALWAYS_REQUEST_OBJECTS = false; Settings.MULTIPLE_SIMS = false; Settings.ENABLE_SIMSTATS = true; Settings.LOGOUT_TIMEOUT = 20000; Settings.LOG_RESENDS = false; Settings.USE_ASSET_CACHE = false; Throttle.Cloud = 0; Throttle.Task = 0; Throttle.Wind = 0; Throttle.Asset = 50000; Throttle.Resend = 500000; Throttle.Texture = 500000; lastRequest = DateTime.Now; sessionID = Guid.NewGuid(); Settings.LOGIN_SERVER = creds.gridURL; this.creds = creds; tracker = new NearbyAvatarTracker(this); }