public bool SignIn(string username, string password) { var signInRequest = new SIMCommon.Requests.SignIn(username, password); try { var response = JsonConvert.DeserializeObject <SIMCommon.Responses.SignIn>(this.SendEncryptedRequest(signInRequest)); return(response.Success); } catch (InvalidResponseException) { return(false); } }
private string RequestHandler(IPAddress address, SIMCommon.Requests.SignIn request) { SIMCommon.Responses.SignIn result; if (this.Database.UserExists(request.Username)) { var user = this.Database.GetUser(this.Database.GetUserID(request.Username)); if (user.Authenticate(request.Password)) { this.Clients[address].LoadUser(user); result = new SIMCommon.Responses.SignIn(true); } else { result = new SIMCommon.Responses.SignIn(false); } } else { result = new SIMCommon.Responses.SignIn(false); } return(JsonConvert.SerializeObject(result)); }