public async Task <ActionResult <IAuthResponse> > GetAuthAutostart(string ip) { _authRequest.EndUserIp = ip; IAuthResponse response = await _bankIdService.Auth(_authRequest); return(new ActionResult <IAuthResponse>(response)); }
public IProfileResponse GetResponse(IAuthResponse authResponse) { if (authResponse == null) { return(new DefaultProfileResponse(string.Empty, string.Empty, "MISSING_AUTHENTICATION", new ArgumentNullException())); } else if (!authResponse.IsValid) { return(new DefaultProfileResponse(string.Empty, string.Empty, "INVALID_AUTHENTICATION", new ArgumentException())); } else if (string.IsNullOrEmpty(authResponse.GetUserId().Trim())) { return(new DefaultProfileResponse(string.Empty, string.Empty, "INVALID_IDENTIFIER", new ArgumentException())); } else { string id = authResponse.GetUserId(); try { return(new DefaultProfileResponse(id, GetProfile(id), "OK")); } catch (Exception e) { new SIGUANETDesktopException(ExceptionCategory.LOADERAuthenticationAborted, "DefaultProfileRequest.GetResponse", e); return(new DefaultProfileResponse(id, string.Empty, "UNRESOLVED_PROFILE", e)); } } }
public async Task <UserInfo> UserInfoRequest(HttpClient client, IAuthResponse spotiCredentials) { var success = false; while (!success) { var userDataRequest = new HttpRequestMessage() { RequestUri = new Uri("https://api.spotify.com/v1/me"), Method = HttpMethod.Get }; userDataRequest.Headers.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", spotiCredentials.Access_token); var userDataResponse = await client.SendAsync(userDataRequest); if (userDataResponse.IsSuccessStatusCode) { var userData = JsonConvert.DeserializeObject <UserInfo>(await userDataResponse.Content.ReadAsStringAsync()); return(userData); } else if (userDataResponse.StatusCode == System.Net.HttpStatusCode.TooManyRequests) { Thread.Sleep((int)userDataResponse.Headers.RetryAfter.Delta.Value.TotalMilliseconds); } else { break; } } return(null); }
public async Task <ActionResult <IAuthResponse> > GetAuth(string ip, string personalNumber) { _authRequest.EndUserIp = ip; _authRequest.PersonalNumber = personalNumber; IAuthResponse response = await _bankIdService.Auth(_authRequest); return(new ActionResult <IAuthResponse>(response)); }
/// <summary> /// Creates a token from the SSO response /// </summary> /// <param name="response"></param> /// <param name="authUrl"></param> /// <param name="scope"></param> /// <returns></returns> async Task <IOauthToken> GetToken(IAuthResponse response, AuthUrl authUrl, IScope scope) { var tokenRequest = GetTokenRequest(response.Code, authUrl.CodeVerifier); var tokenResponse = await client.SendAsync(tokenRequest); string json = await tokenResponse.Content.ReadAsStringAsync(); return(tokenFactory.FromJson(json, scope)); }
public async Task <ActionResult <IAuthResponse> > GetSignAutostart(string ip, string userVisibleData, string userNonVisibleData = "") { _signRequest.EndUserIp = ip; _signRequest.UserVisibleData = userVisibleData; if (!string.IsNullOrEmpty(userNonVisibleData)) { _signRequest.UserNonVisibleData = userNonVisibleData; } IAuthResponse response = await _bankIdService.Sign(_signRequest); return(new ActionResult <IAuthResponse>(response)); }
public async Task <(IOauthToken token, string owner)> ListenForResponse(IScope scope, AuthUrl authUrl) { IAuthResponse response = await responseManager.AwaitResponse(20000); if (authUrl.State != response.State) { throw new Exception("Invalid auth response state."); } IOauthToken token = await GetToken(response, authUrl, scope); IJwtToken jwtToken = await validationManager.ValidateTokenAsync(token); return(token, jwtToken.Name); }
public async Task <(IOauthToken token, string owner)> GetToken(IScope scope) { AuthUrl authUrl = GenerateAuthUrl(scope.ScopeString); IAuthResponse response = await responseManager.GetResponse(authUrl.Url, 10000); if (authUrl.State != response.State) { throw new Exception("Invalid auth response state."); } IOauthToken token = await GetToken(response, authUrl, scope); IJwtToken jwtToken = await validationManager.ValidateTokenAsync(token); return(token, jwtToken.Name); }
public SamlController(ILoggerFactory logger, IOptions <AuthConfiguration> spidConfiguration, RequestOptionFactory requestOptionFactory, IAuthRequest authRequest, IAuthResponse authResponse, ILogoutResponse logoutResponse, ITokenService tokenService, IdpHelper idpHelper, IDataProtectionService dataProtectionService) { _logger = logger.CreateLogger(LogCategories.AUTHENGINE); _traceLogger = logger.CreateLogger(LogCategories.SAMLTRACE); _sessionAuthLogger = logger.CreateLogger(LogCategories.AUTHSESSION); _spidConfiguration = spidConfiguration?.Value; _requestOptionFactory = requestOptionFactory; _authRequest = authRequest; _authResponse = authResponse; _logoutResponse = logoutResponse; _tokenService = tokenService; _idpHelper = idpHelper; _dataProtectionService = dataProtectionService; }
public async Task <IAuthResponse> RefreshTokenAsync(IAuthResponse model) { var user = await GetUserFromAccessTokenAsync(model.AccessToken); if (user != null && (await ValidateRefreshTokenAsync(user, model.RefreshToken))) { string tokenAsString = await GenerateAccessTokenAsync(user); return(new AuthResponse { AccessToken = tokenAsString, ExpireDate = DateTime.Now.AddDays(1), RefreshToken = model.RefreshToken }); } throw new ValidationException(ExceptionMapping.None, "Failed to refresh"); }
public async Task <string> GenerateToken(UserInfo userData, IAuthResponse credentials) { var auth = FirebaseAuth.GetAuth(this.firebase); try { await auth.GetUserAsync(userData.Id); // If the user does not exist an exception is thrown await auth.UpdateUserAsync(new UserRecordArgs() { Email = userData.Email, DisplayName = userData.Display_name, Uid = userData.Id, PhotoUrl = userData.Images.FirstOrDefault()?.Url }); } catch (FirebaseAuthException) { await auth.CreateUserAsync(new UserRecordArgs() { Email = userData.Email, DisplayName = userData.Display_name, Uid = userData.Id, PhotoUrl = userData.Images.FirstOrDefault()?.Url }); } var user = new Entities.Application.User(userData, credentials.Access_token, credentials.Expires_in, DateTime.UtcNow); if (!string.IsNullOrEmpty(credentials.Refresh_Token)) { user.RefreshToken = credentials.Refresh_Token; } await this.CreateOrUpdateUser(user); var token = await auth.CreateCustomTokenAsync(user.Id); return(token); }
private async Task <string> GenerateToken(UserInfo userData, IAuthResponse credentials) { var auth = FirebaseAuth.GetAuth(firebaseApp); try { await auth.GetUserAsync(userData.Id); // If the user does not exist an exception is thrown await auth.UpdateUserAsync(new UserRecordArgs() { Email = userData.Email, DisplayName = userData.Display_name, Uid = userData.Id, PhotoUrl = userData.Images.FirstOrDefault()?.Url }); } catch (FirebaseAuthException) { await auth.CreateUserAsync(new UserRecordArgs() { Email = userData.Email, DisplayName = userData.Display_name, Uid = userData.Id, PhotoUrl = userData.Images.FirstOrDefault()?.Url }); } // var user = new User(userData, credentials.Access_token, credentials.Expires_in, DateTime.UtcNow); var reference = firestoreDb.Collection("users").Document($"{userData.Id}"); //if ((await reference.GetSnapshotAsync()).Exists) // await reference.UpdateAsync(user.ToDictionary()); //else // await reference.CreateAsync(user.ToDictionary()); var token = await auth.CreateCustomTokenAsync(userData.Id); return(token); }
private void EmailOptInCallback(IAuthProvider sender, IAuthResponse response) { if (response.SuccessCode == 1) { } }
private void GetOnlineWorldsCallback(IAuthProvider sender, IAuthResponse response) { if (response.SuccessCode != 1) { this.throwClientErrorConnection(this.lblLoginError, response.Message); } else { WorldList = ((XmlRpcAuthResponse) response).WorldList; this.processVacationModeInfo(WorldList); this.ShowOnlinePanels(); } }
private void GetOfflineWorldsCallback(IAuthProvider sender, IAuthResponse response) { if (response.SuccessCode != 1) { this.throwClientErrorConnection(this.lblLoginError, response.Message); } else { WorldList = ((XmlRpcAuthResponse) response).WorldList; LanguageList = new Dictionary<string, LocalizationLanguage>(); foreach (WorldInfo info in WorldList) { if (!LanguageList.ContainsKey(info.Supportculture)) { LocalizationLanguage language = new LocalizationLanguage { CultureCode = info.Supportculture }; LanguageList.Add(info.Supportculture, language); } } if (Program.mySettings.NumWorldsCount < 0) { Program.mySettings.NumWorldsCount = WorldList.Count; Program.mySettings.NumWorldsLastChanged = DateTime.MinValue; Program.mySettings.Save(); } else if (Program.mySettings.NumWorldsCount != WorldList.Count) { Program.mySettings.NumWorldsCount = WorldList.Count; Program.mySettings.NumWorldsLastChanged = DateTime.Now; Program.mySettings.Save(); NewWorldsAvailable = true; } else { TimeSpan span = (TimeSpan) (DateTime.Now - Program.mySettings.NumWorldsLastChanged); if (span.TotalDays < 7.0) { NewWorldsAvailable = true; } } if (DateTime.Now < new DateTime(0x7dc, 2, 0x12)) { NewWorldsAvailable = false; } List<WorldInfo> worldsBySupportCulture = this.GetWorldsBySupportCulture(""); this.BuildOfflineWorldList(worldsBySupportCulture); if (NewWorldsAvailable) { if (this.lblNewWorlds == null) { this.lblNewWorlds = new CustomSelfDrawPanel.CSDLabel(); } this.lblNewWorlds.Text = SK.Text("LOGIN_New_Worlds", "A New World is available!"); this.lblNewWorlds.Color = ARGBColors.Green; this.lblNewWorlds.Position = new Point(10, this.LoginPanelControls_LoggedOut.Height - 70); this.lblNewWorlds.Size = new Size(this.LoginPanelControls_LoggedOut.Width - 20, 40); this.lblNewWorlds.Alignment = CustomSelfDrawPanel.CSD_Text_Alignment.TOP_CENTER; this.lblNewWorlds.Font = FontManager.GetFont("Arial", 8f, FontStyle.Regular); this.LoginPanelControls_LoggedOut.removeControl(this.lblNewWorlds); this.LoginPanelControls_LoggedOut.addControl(this.lblNewWorlds); } if (this.chkAutoLogin != null) { this.chkAutoLogin.Visible = false; } if (Program.mySettings.LastWorldID >= 0) { string str = ""; foreach (WorldInfo info2 in worldsBySupportCulture) { if (info2.KingdomsWorldID == Program.mySettings.LastWorldID) { str = getWorldShortDesc(info2); break; } } if (str.Length > 0) { if (this.chkAutoLogin != null) { this.LoginPanelControls_LoggedOut.removeControl(this.chkAutoLogin); } this.chkAutoLogin = new CustomSelfDrawPanel.CSDCheckBox(); this.chkAutoLogin.CheckedImage = (Image) GFXLibrary.mrhp_world_filter_check[0]; this.chkAutoLogin.UncheckedImage = (Image) GFXLibrary.mrhp_world_filter_check[1]; this.chkAutoLogin.Position = new Point(10, this.LoginPanelControls_LoggedOut.Height - 90); this.chkAutoLogin.Checked = Program.mySettings.AutoLogin; this.chkAutoLogin.CBLabel.Text = SK.Text("LOGIN_Auto_Load", "Auto Connect to : ") + str; this.chkAutoLogin.CBLabel.Color = ARGBColors.Black; this.chkAutoLogin.CBLabel.Position = new Point(20, -1); this.chkAutoLogin.CBLabel.Size = new Size(this.LoginPanelControls_LoggedOut.Width, 0x19); this.chkAutoLogin.CBLabel.Font = FontManager.GetFont("Arial", 8f, FontStyle.Regular); this.chkAutoLogin.setCheckChangedDelegate(new CustomSelfDrawPanel.CSDCheckBox.CSD_CheckChangedDelegate(this.autoLoadToggled)); this.chkAutoLogin.Visible = true; this.LoginPanelControls_LoggedOut.addControl(this.chkAutoLogin); this.LoginPanelControls_LoggedOut.Invalidate(); } } } }
private void JoinGameworldCallback(IAuthProvider sender, IAuthResponse response) { if (response.SuccessCode == 1) { foreach (WorldInfo info in WorldList) { if ((info.KingdomsWorldID == this.lastWorldLoggedIn) && !info.Playing) { info.Playing = true; } } string admin = string.Empty; if ((this.AdminGUID != null) && (this.AdminGUID.Length > 0)) { admin = this.AdminGUID; } if (!Program.kingdomsAccountFound) { this.LoginBeta(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), RemoteServices.Instance.SessionGuid.ToString().Replace("-", ""), this.txtEmail.Text, admin); } else { this.LoginBeta(RemoteServices.Instance.UserGuid.ToString().Replace("-", ""), RemoteServices.Instance.SessionGuid.ToString().Replace("-", ""), Program.steamEmail, admin); } } else { this.lblRetrieving.Visible = false; this.tandcLabel.Visible = true; this.gameRulesLabel.Visible = true; if (Program.bigpointInstall || Program.bigpointPartnerInstall) { this.forumLabel.Visible = false; } else { this.forumLabel.Visible = true; } this.supportLabel.Visible = true; this.feedbackProgress.Size = new Size(Math.Min(this.pnlFeedback.Width / 11, this.pnlFeedback.Width), this.pnlFeedback.Height); this.feedbackProgressArea.invalidate(); this.Text = this.defaultWindowTitle; this.cancelButton.Visible = false; MessageBox.Show("ERROR: " + response.Message); this.EnablePanels(true); } }
private void usernameCheckCallbackThenCreate(IAuthProvider sender, IAuthResponse response) { this.usernameValidationInProgress = false; this.lastUsernameChecked = response.Username; if (response.SuccessCode == 1) { this.lastUsernameValid = true; this.CreateUser(); } else { this.lastUsernameValid = false; } }
private void usernameCheckCallback(IAuthProvider sender, IAuthResponse response) { this.usernameValidationInProgress = false; this.lastUsernameChecked = response.Username; if (response.SuccessCode == 1) { this.lastUsernameValid = true; } else { this.lastUsernameValid = false; } this.NextButton.Image = this.NextImage; if ((this.txtUsername.Text.Length < 4) || (this.txtUsername.Text.Length > 0x12)) { this.FeedbackLabel.Color = ARGBColors.Red; this.FeedbackLabel.Text = string.Empty; } else if (this.lastUsernameValid) { this.FeedbackLabel.Color = ARGBColors.Green; this.FeedbackLabel.Text = response.Message; } else { this.FeedbackLabel.Color = ARGBColors.Red; this.FeedbackLabel.Text = response.Message; } this.ValidateNextButton(); }
private void ClientLogoutCallback(IAuthProvider sender, IAuthResponse response) { RemoteServices.Instance.UserGuid = Guid.Empty; RemoteServices.Instance.SessionGuid = Guid.Empty; this.AdminGUID = null; if (response.SuccessCode != 1) { this.throwClientErrorConnection(this.lblLoginError, response.Message); } this.PlayerGameworldCount = 0; this.GetOfflineWorlds(); this.RefreshControls(); this.geckoWebBrowser1.Navigate(URLs.NewsMainPage); this.EnablePanels(true); if (Program.bigpointInstall || Program.bigpointPartnerInstall) { this.forumLabel.Visible = false; } }
private void LoginCallback(IAuthProvider sender, IAuthResponse response) { if (this.connectingCancelled) { this.openAfterCancel(); this.manageLoginButton(); } else if (response.SuccessCode.HasValue && (response.SuccessCode.Value == 1)) { int? nullable10; int? nullable12; int? nullable14; int? nullable16; int? nullable18; int? nullable20; int? nullable22; int? nullable24; int? nullable26; int? nullable28; RemoteServices.Instance.BoxUser = response.PremiumBox.HasValue && (response.PremiumBox.Value == 1); GameEngine.Instance.World.ProfileCrowns = response.Crowns.GetValueOrDefault(); GameEngine.Instance.World.ProfilePremiumCards = response.PremiumCards.GetValueOrDefault(); GameEngine.Instance.World.ProfileCardpoints = response.Cardpoints.GetValueOrDefault(); GameEngine.Instance.World.ProfileNumFriends = response.Friends.GetValueOrDefault(); GameEngine.Instance.World.isBigpointAccount = response.isBigPoint; RemoteServices.Instance.MapEditor = false; GameEngine.Instance.World.MapEditing = false; GameEngine.Instance.World.ProfilePremiumTokens.Clear(); foreach (int num in response.Tokens.Keys) { GameEngine.Instance.World.ProfilePremiumTokens.Add(num, response.Tokens[num]); } GameEngine.Instance.World.ProfileCards.Clear(); foreach (int num2 in response.Cards.Keys) { GameEngine.Instance.World.addProfileCard(num2, response.Cards[num2]); } GameEngine.Instance.World.ProfileCardOffers.Clear(); foreach (int num3 in response.CardOffers.Keys) { GameEngine.Instance.World.ProfileCardOffers.Add(num3, response.CardOffers[num3]); } GameEngine.Instance.World.ProfileUserCardPacks.Clear(); foreach (int num4 in response.UserCardPacks.Keys) { GameEngine.Instance.World.ProfileUserCardPacks.Add(num4, response.UserCardPacks[num4]); } bool[] flagArray2 = new bool[10]; nullable10 = null; nullable12 = null; nullable14 = null; nullable16 = null; nullable18 = null; nullable20 = null; nullable22 = null; nullable24 = null; nullable26 = null; nullable28 = null; if (((XmlRpcAuthResponse) response).VeteranLevel1.HasValue) { nullable10 = ((XmlRpcAuthResponse) response).VeteranLevel1; } flagArray2[0] = (nullable10.GetValueOrDefault() == 1) && nullable10.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel2.HasValue) { nullable12 = ((XmlRpcAuthResponse) response).VeteranLevel2; } flagArray2[1] = (nullable12.GetValueOrDefault() == 1) && nullable12.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel3.HasValue) { nullable14 = ((XmlRpcAuthResponse) response).VeteranLevel3; } flagArray2[2] = (nullable14.GetValueOrDefault() == 1) && nullable14.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel4.HasValue) { nullable16 = ((XmlRpcAuthResponse) response).VeteranLevel4; } flagArray2[3] = (nullable16.GetValueOrDefault() == 1) && nullable16.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel5.HasValue) { nullable18 = ((XmlRpcAuthResponse) response).VeteranLevel5; } flagArray2[4] = (nullable18.GetValueOrDefault() == 1) && nullable18.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel6.HasValue) { nullable20 = ((XmlRpcAuthResponse) response).VeteranLevel6; } flagArray2[5] = (nullable20.GetValueOrDefault() == 1) && nullable20.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel7.HasValue) { nullable22 = ((XmlRpcAuthResponse) response).VeteranLevel7; } flagArray2[6] = (nullable22.GetValueOrDefault() == 1) && nullable22.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel8.HasValue) { nullable24 = ((XmlRpcAuthResponse) response).VeteranLevel8; } flagArray2[7] = (nullable24.GetValueOrDefault() == 1) && nullable24.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel9.HasValue) { nullable26 = ((XmlRpcAuthResponse) response).VeteranLevel9; } flagArray2[8] = (nullable26.GetValueOrDefault() == 1) && nullable26.HasValue; if (((XmlRpcAuthResponse) response).VeteranLevel10.HasValue) { nullable28 = ((XmlRpcAuthResponse) response).VeteranLevel10; } flagArray2[9] = (nullable28.GetValueOrDefault() == 1) && nullable28.HasValue; bool[] stages = flagArray2; if (((XmlRpcAuthResponse) response).VeteranLevel6.HasValue && (((XmlRpcAuthResponse) response).VeteranLevel6 == 2)) { GameEngine.Instance.World.InviteSystemNotImplemented = true; } else { GameEngine.Instance.World.InviteSystemNotImplemented = false; } if (((XmlRpcAuthResponse) response).VeteranCurrentLevel.HasValue && ((XmlRpcAuthResponse) response).VeteranSecondsLeft.HasValue) { GameEngine.Instance.World.importFreeCardData(((XmlRpcAuthResponse) response).VeteranCurrentLevel.Value, stages, DateTime.Now.AddSeconds((double) ((XmlRpcAuthResponse) response).VeteranSecondsLeft.Value), DateTime.Now); } GameEngine.Instance.World.calcAvailableCategories(); RemoteServices.Instance.UserGuid = new Guid(response.UserGUID); RemoteServices.Instance.SessionGuid = new Guid(response.SessionID); Console.WriteLine("UserGuid: {0}; SessionGuid: {1}", response.UserGUID, response.SessionID); URLs.GameRPCAddress = this.serverAddr; URLs.ChatRPCAddress = this.serverAddr; RemoteServices.Instance.init(URLs.GameRPC); RemoteServices.Instance.set_LoginUserGuid_UserCallBack(new RemoteServices.LoginUserGuid_UserCallBack(this.loginUserGuid)); RemoteServices.Instance.LoginUserGuid(storedUserLoginEmail, RemoteServices.Instance.UserGuid, RemoteServices.Instance.SessionGuid); this.Cursor = Cursors.WaitCursor; } else if (response.Message == "On Vacation.") { MyMessageBox.Show(SK.Text("Login_Vacation_Error", "Your Account is currently in Vacation Mode and you are not able to log into this game world at this time."), SK.Text("ProfileLoginWindow_Login_Error", "Login Error")); this.btnExit_Click(); } else { MyMessageBox.Show(response.Message, SK.Text("ProfileLoginWindow_Login_Error", "Login Error")); this.openAfterCancel(); this.manageLoginButton(); } }
private void createUserCallback(IAuthProvider sender, IAuthResponse response) { if (response.SuccessCode == 1) { Program.kingdomsAccountFound = true; if (Program.steamActive) { Program.profileLogin.SetSteamEmail(this.txtEmail.Text); } else { Program.profileLogin.SetNonSteamEmail(this.txtEmail.Text, this.txtPassword.Text); } Program.profileLogin.btnLogin_Click(); InterfaceMgr.Instance.closeCreatePopupWindow(); if ((!Program.steamActive && !Program.gamersFirstInstall) && !Program.arcInstall) { MyMessageBox.Show(SK.Text("Login_Account_Created_Message", "Your account has been created and you will receive an Authorization Email soon. Follow the instructions in this email and then you will be able to join game worlds in Stronghold Kingdoms."), SK.Text("Login_Account_Created", "Account Created")); } } else { this.FeedbackLabel.Color = ARGBColors.Red; this.FeedbackLabel.TextDiffOnly = response.Message; this.NextButton.Enabled = true; this.NextButton.Image = this.NextImage; this.txtEmail.Enabled = true; this.txtEmailconfirm.Enabled = true; this.txtUsername.Enabled = true; this.txtPassword.Enabled = true; this.txtPasswordconfirm.Enabled = true; } }
private void ClientLoginCallback(IAuthProvider sender, IAuthResponse response) { if (response.SuccessCode != 1) { if (Program.bigpointPartnerInstall) { if (this.bp2_loginMode == 1) { BPPopupWindow window = InterfaceMgr.Instance.getBPPopupWindow(); if (window != null) { window.attempt1Failed(); this.EnablePanels(true); } return; } if (this.bp2_loginMode == 2) { this.bp2_loginMode = 0; this.btnLogin.Enabled = true; InterfaceMgr.Instance.closeBPPopupWindow(); } } if (this.FacebookToken == "") { GameEngine.Instance.playInterfaceSound("ProfileLoginWindow_login_failed"); if ((response.Message.ToLower() == "the provided password is incorrect.") || (response.Message.ToLower() == "the specified user doesn't exist.")) { this.throwClientError(this.lblLoginError, response.Message); } else { this.throwClientErrorConnection(this.lblLoginError, response.Message); } if (Program.aeriaInstall) { this.openAeriaPopup(); } if (Program.bigpointInstall) { this.openBigPointPopup(); } } else { Program.mySettings.facebookaccesstoken = ""; if (this.specialFacebookLogin) { this.openFacebookPopup(); this.EnablePanels(true); } } this.specialFacebookLogin = false; } else { successfulAutoLogin = true; GameEngine.Instance.playInterfaceSound("ProfileLoginWindow_login_success"); if (Program.bigpointPartnerInstall) { bp2_logoutURL = response.Password; InterfaceMgr.Instance.closeBPPopupWindow(); } if (this.FacebookToken != "") { Program.mySettings.facebookaccesstoken = this.FacebookToken; LoggedInViaFacebook = true; } else { Program.mySettings.facebookaccesstoken = ""; } this.specialFacebookLogin = false; if (Program.gamersFirstInstall && (response.Username.Length == 0)) { this.EnablePanels(true); gfEmail = this.txtEmail.Text; gfPW = this.txtPassword.Text; this.delayedCreateUserOpen = true; } else if (Program.arcInstall && (response.Username.Length == 0)) { this.EnablePanels(true); gfEmail = this.txtEmail.Text; gfPW = this.txtPassword.Text; this.delayedCreateUserOpen = true; } else { if ((Program.aeriaInstall || Program.gamersFirstInstall) || (Program.arcInstall || Program.bigpointInstall)) { Program.mySettings.Username = response.Username; } else if (!Program.kingdomsAccountFound) { Program.mySettings.Username = this.txtEmail.Text; } else { Program.mySettings.Username = Program.steamEmail; } Program.mySettings.HasLoggedIn = true; WorldList = ((XmlRpcAuthResponse) response).WorldList; DataExport.email = this.txtEmail.Text; if (!DataExport.Check()) { //base.Close(); this.Close(); } #if DEBUG DataExport.DumpWorldList(WorldList); #endif this.processVacationModeInfo(WorldList); ShieldURL = ((XmlRpcAuthResponse) response).Shields; RemoteServices.Instance.UserGuid = new Guid(response.UserGUID); RemoteServices.Instance.SessionGuid = new Guid(response.SessionID); RemoteServices.Instance.UserName = response.Username; string specialURL = ((XmlRpcAuthResponse) response).SpecialURL; if (((XmlRpcAuthResponse) response).hasUnviewedOffers) { specialURL = URLs.AccountOffersPage; } if (specialURL.Length > 0) { string url = specialURL + "?lang=" + Program.mySettings.LanguageIdent.ToLower() + "&culture=" + Program.mySettings.LanguageIdent.ToLower() + "&u=" + response.UserGUID + "&s=" + response.SessionID; this.geckoWebBrowser1.Navigate(url); } bool flag = false; if (response.OnVacation.HasValue && (response.OnVacation != 0)) { flag = true; } if ((flag && (this.chkAutoLogin != null)) && this.chkAutoLogin.Checked) { this.chkAutoLogin.Checked = false; } GameEngine.Instance.World.FacebookFreePack = false; if (response.FacebookFreePack.HasValue && (response.FacebookFreePack != 0)) { GameEngine.Instance.World.FacebookFreePack = true; } if (Program.bigpointInstall || Program.bigpointPartnerInstall) { this.forumLabel.Visible = true; } this.ShowOnlinePanels(); GameEngine.Instance.World.NumVacationsAvailable = 2 - response.VacationsTaken.Value; GameEngine.Instance.World.VacationNot30Days = false; if (response.VacationPossible.HasValue) { if (response.VacationPossible <= 0) { GameEngine.Instance.World.NumVacationsAvailable = 0; if (response.VacationPossible == -1) { GameEngine.Instance.World.VacationNot30Days = true; } } } else { GameEngine.Instance.World.NumVacationsAvailable = 0; } if (flag && ((this.AdminGUID == null) || (this.AdminGUID.Length == 0))) { try { int secondsLeft = response.VacationSecondsLeft.Value; int secondsLeftToCancel = response.VacationSecondsToCancel.Value; bool canCancel = false; if (response.CancelVacation.HasValue && (response.CancelVacation != 0)) { canCancel = true; } InterfaceMgr.Instance.openVacationCancelPopupWindow(secondsLeft, secondsLeftToCancel, canCancel); return; } catch (Exception) { } } if (response.RequiresOptInCheck.HasValue) { bool flag1 = response.RequiresOptInCheck > 0; } StatTrackingClient.Instance().Init("http://shk-data.strongholdkingdoms.com", RemoteServices.Instance.UserGuid.ToString()); } } }