public bool Authenticate() { // Create a new account on the web server. var client = new AuthenticationWebServiceClient("http://localhost/2.0"); var loginResult = client.LoginSteam(SteamId, string.Empty, string.Empty); if (loginResult.MemberAuthenticationResult != MemberAuthenticationResult.Ok) { Console.Error.WriteLine("[TestCommPeer] WS -> Failed to login through the web server."); return(false); } _authToken = loginResult.AuthToken; _member = loginResult.MemberView; // Complete the account, so we can set the user name. var completeResult = client.CompleteAccount(Profile.Cmid, Name, ChannelType.Steam, "en_US", string.Empty); if (completeResult.Result != 1) { Console.Error.WriteLine("[TestCommPeer] WS -> Failed to complete account through the web server."); return(false); } Console.WriteLine("[TestCommPeer] WS -> Login success!"); return(true); }
//TODO: Write some stress test code or some stuff. public static void Main(string[] args) { var userServiceClient = new UserWebServiceClient("http://localhost/2.0"); var authenticationServiceClient = new AuthenticationWebServiceClient("http://localhost/2.0"); var loginResult = authenticationServiceClient.LoginSteam("test", "", ""); var member = userServiceClient.GetMember(loginResult.AuthToken); Console.WriteLine(member.CmuneMemberView); Console.WriteLine(member.UberstrikeMemberView); Console.ReadLine(); }
private void logInButton_Click(object sender, RoutedEventArgs e) { if (userNameTextBox.Text.Equals("") || passwordTextBox.Password.Equals("")) { MessageBox.Show("Toate campurile trebuie completate."); } else { AuthenticationWebServiceClient proxy = new AuthenticationWebServiceClient(); proxy.AuthenticateCompleted += new EventHandler<AuthenticateCompletedEventArgs>(proxy_AuthenticateCompleted); proxy.AuthenticateAsync(userNameTextBox.Text, passwordTextBox.Password); ShowPopup(); } }
public IEnumerator StartLoginMemberEmail(string emailAddress, string password) { if (string.IsNullOrEmpty(emailAddress) || string.IsNullOrEmpty(password)) { ShowLoginErrorPopup(LocalizedStrings.Error, "Your login credentials are not correct. Please try to login again."); yield break; } _progress.Text = "Authenticating Account"; _progress.Progress = 0.1f; PopupSystem.Show(_progress); MemberAuthenticationResultView authenticationView = null; if (ApplicationDataManager.Channel == ChannelType.Steam) { yield return(AuthenticationWebServiceClient.LinkSteamMember(emailAddress, password, PlayerDataManager.SteamId, SystemInfo.deviceUniqueIdentifier, delegate(MemberAuthenticationResultView ev) { authenticationView = ev; PlayerPrefs.SetString("CurrentSteamUser", PlayerDataManager.SteamId); PlayerPrefs.Save(); }, delegate(Exception ex) { })); } else { yield return(AuthenticationWebServiceClient.LoginMemberEmail(emailAddress, password, ApplicationDataManager.Channel, SystemInfo.deviceUniqueIdentifier, delegate(MemberAuthenticationResultView ev) { authenticationView = ev; }, delegate(Exception ex) { })); } if (authenticationView == null) { ShowLoginErrorPopup(LocalizedStrings.Error, "The login could not be processed. Please check your internet connection and try again."); yield break; } yield return(UnityRuntime.StartRoutine(CompleteAuthentication(authenticationView, false))); yield break; }
public IEnumerator StartLoginMemberSteam(bool directSteamLogin) { if (directSteamLogin) { _progress.Text = "Authenticating with Steam"; _progress.Progress = 0.05f; PopupSystem.Show(_progress); m_GetAuthSessionTicketResponse = Callback <GetAuthSessionTicketResponse_t> .Create(new Callback <GetAuthSessionTicketResponse_t> .DispatchDelegate(OnGetAuthSessionTicketResponse)); byte[] ticket = new byte[1024]; uint pcbTicket; HAuthTicket authTicket = SteamUser.GetAuthSessionTicket(ticket, 1024, out pcbTicket); int num = (int)pcbTicket; string authToken = num.ToString(); string machineId = SystemInfo.deviceUniqueIdentifier; MemberAuthenticationResultView authenticationView = null; _progress.Text = "Authenticating with UberStrike"; _progress.Progress = 0.1f; yield return(AuthenticationWebServiceClient.LoginSteam(PlayerDataManager.SteamId, authToken, machineId, delegate(MemberAuthenticationResultView result) { authenticationView = result; PlayerPrefs.SetString("CurrentSteamUser", PlayerDataManager.SteamId); PlayerPrefs.Save(); }, delegate(Exception error) { Debug.LogError("Account authentication error: " + error); ShowLoginErrorPopup(LocalizedStrings.Error, "There was an error logging you in. Please try again or contact us at http://support.cmune.com"); })); yield return(UnityRuntime.StartRoutine(CompleteAuthentication(authenticationView, false))); } else { PopupSystem.ClearAll(); yield return(PanelManager.Instance.OpenPanel(PanelType.Login)); } yield break; }
// Token: 0x06000CA4 RID: 3236 RVA: 0x00055838 File Offset: 0x00053A38 private void DrawOKButton(Rect position) { GUI.enabled = (!this._waitingForWsReturn && !string.IsNullOrEmpty(this._characterName)); if (GUITools.Button(new Rect((position.width - 120f) / 2f, position.height - 42f, 120f, 32f), new GUIContent(LocalizedStrings.OkCaps), BlueStonez.button_green)) { this.HideKeyboard(); string name = this._characterName; if (this._selectedIndex != -1) { name = this._availableNames[this._selectedIndex]; } this._waitingForWsReturn = true; AuthenticationWebServiceClient.CompleteAccount(PlayerDataManager.Cmid, name, ApplicationDataManager.Channel, ApplicationDataManager.CurrentLocale.ToString(), SystemInfo.deviceUniqueIdentifier, delegate(AccountCompletionResultView ev) { this.CompleteAccountCallback(ev, name); }, delegate(Exception ex) { this._waitingForWsReturn = false; this._feedbackMessageColor = Color.red; this._errorMessage = "Webservice error"; }); } GUI.enabled = true; }
private void addCreditButton_Click(object sender, RoutedEventArgs e) { string sAmount = amountTextBox.Text.Trim(); decimal amount; if (sAmount.Equals("") || !decimal.TryParse(sAmount, out amount)) { MessageBox.Show("Adauga o suma valida!"); } else { ShowPopup(); AuthenticationWebServiceClient service = new AuthenticationWebServiceClient(); service.AddFundsCompleted += new EventHandler<AddFundsCompletedEventArgs>(service_AddFundsCompleted ); service.AddFundsAsync(new AccountWebServiceModel() {GUID = (App.Current as App).UserData.GUID }, amount); } }
// Token: 0x06000D66 RID: 3430 RVA: 0x0005D9FC File Offset: 0x0005BBFC private void OnGUI() { if (Mathf.Abs(this._keyboardOffset - this._targetKeyboardOffset) > 2f) { this._keyboardOffset = Mathf.Lerp(this._keyboardOffset, this._targetKeyboardOffset, Time.deltaTime * 4f); } else { this._keyboardOffset = this._targetKeyboardOffset; } Rect position = new Rect((float)(Screen.width - 500) * 0.5f, ((float)Screen.height - this._height) * 0.5f - this._keyboardOffset, 500f, this._height); GUI.BeginGroup(position, GUIContent.none, BlueStonez.window); GUI.Label(new Rect(0f, 0f, position.width, 56f), LocalizedStrings.Welcome, BlueStonez.tab_strip); Rect position2 = new Rect(20f, 55f, position.width - 40f, position.height - 78f); GUI.Label(position2, GUIContent.none, BlueStonez.window_standard_grey38); GUI.BeginGroup(position2); GUI.Label(new Rect(0f, 0f, position2.width, 60f), LocalizedStrings.PleaseProvideValidEmailPasswordMsg, BlueStonez.label_interparkbold_18pt); GUI.Label(new Rect(0f, 76f, 170f, 11f), LocalizedStrings.Email, BlueStonez.label_interparkbold_11pt_right); GUI.Label(new Rect(0f, 110f, 170f, 11f), LocalizedStrings.Password, BlueStonez.label_interparkbold_11pt_right); GUI.Label(new Rect(0f, 147f, 170f, 11f), LocalizedStrings.VerifyPassword, BlueStonez.label_interparkbold_11pt_right); GUI.enabled = this._enableGUI; GUI.SetNextControlName("@Email"); this._emailAddress = GUI.TextField(new Rect(180f, 69f, 180f, 22f), this._emailAddress, BlueStonez.textField); if (string.IsNullOrEmpty(this._emailAddress) && GUI.GetNameOfFocusedControl() != "@Email") { GUI.color = new Color(1f, 1f, 1f, 0.3f); GUI.Label(new Rect(188f, 75f, 180f, 22f), LocalizedStrings.EnterYourEmailAddress, BlueStonez.label_interparkmed_11pt_left); GUI.color = Color.white; } GUI.SetNextControlName("@Password1"); this._password1 = GUI.PasswordField(new Rect(180f, 104f, 180f, 22f), this._password1, '*', BlueStonez.textField); if (string.IsNullOrEmpty(this._password1) && GUI.GetNameOfFocusedControl() != "@Password1") { GUI.color = new Color(1f, 1f, 1f, 0.3f); GUI.Label(new Rect(188f, 110f, 172f, 18f), LocalizedStrings.EnterYourPassword, BlueStonez.label_interparkmed_11pt_left); GUI.color = Color.white; } GUI.SetNextControlName("@Password2"); this._password2 = GUI.PasswordField(new Rect(180f, 140f, 180f, 22f), this._password2, '*', BlueStonez.textField); if (string.IsNullOrEmpty(this._password2) && GUI.GetNameOfFocusedControl() != "@Password2") { GUI.color = new Color(1f, 1f, 1f, 0.3f); GUI.Label(new Rect(188f, 146f, 180f, 22f), LocalizedStrings.RetypeYourPassword, BlueStonez.label_interparkmed_11pt_left); GUI.color = Color.white; } GUI.enabled = true; GUI.contentColor = this._errorMessageColor; GUI.Label(new Rect(0f, 175f, position2.width, 40f), this._errorMessage, BlueStonez.label_interparkbold_11pt); GUI.contentColor = Color.white; GUI.EndGroup(); GUI.Label(new Rect(100f, position.height - 42f - 22f, 300f, 16f), "By clicking OK you agree to the", BlueStonez.label_interparkbold_11pt); if (GUI.Button(new Rect(185f, position.height - 30f - 12f, 130f, 20f), "Terms of Service", BlueStonez.buttondark_small)) { ApplicationDataManager.OpenUrl("Terms Of Service", "http://www.cmune.com/index.php/terms-of-service/"); this.HideKeyboard(); } GUI.Label(new Rect(207f, position.height - 15f - 22f, 90f, 20f), GUIContent.none, BlueStonez.horizontal_line_grey95); GUI.enabled = this._enableGUI; if (GUITools.Button(new Rect(position.width - 150f, position.height - 42f - 22f, 120f, 32f), new GUIContent(LocalizedStrings.OkCaps), BlueStonez.button_green)) { this.HideKeyboard(); if (!ValidationUtilities.IsValidEmailAddress(this._emailAddress)) { this._targetHeight = 340f; this._errorMessageColor = Color.red; this._errorMessage = LocalizedStrings.EmailAddressIsInvalid; } else if (this._password1 != this._password2) { this._targetHeight = 340f; this._errorMessageColor = Color.red; this._errorMessage = LocalizedStrings.PasswordDoNotMatch; } else if (!ValidationUtilities.IsValidPassword(this._password1)) { this._targetHeight = 340f; this._errorMessageColor = Color.red; this._errorMessage = LocalizedStrings.PasswordInvalidCharsMsg; } else { this._enableGUI = false; this._targetHeight = 340f; this._errorMessageColor = Color.grey; this._errorMessage = LocalizedStrings.PleaseWait; AuthenticationWebServiceClient.CreateUser(this._emailAddress, this._password1, ApplicationDataManager.Channel, ApplicationDataManager.CurrentLocale.ToString(), SystemInfo.deviceUniqueIdentifier, delegate(MemberRegistrationResult result) { if (result == MemberRegistrationResult.Ok) { this.Hide(); CmunePrefs.WriteKey <string>(CmunePrefs.Key.Player_Email, this._emailAddress); CmunePrefs.WriteKey <string>(CmunePrefs.Key.Player_Password, this._password1); UnityRuntime.StartRoutine(Singleton <AuthenticationManager> .Instance.StartLoginMemberEmail(this._emailAddress, this._password1)); this._targetHeight = 300f; this._errorMessage = string.Empty; this._emailAddress = string.Empty; this._password1 = string.Empty; this._password2 = string.Empty; this._errorMessageColor = Color.red; this._enableGUI = true; } else { this._enableGUI = true; this._targetHeight = 340f; this._errorMessageColor = Color.red; this._errorMessages.TryGetValue(result, out this._errorMessage); } }, delegate(Exception ex) { this._enableGUI = true; this._targetHeight = 300f; this._errorMessage = string.Empty; this.ShowSignUpErrorPopup(LocalizedStrings.Error, "Sign Up was unsuccessful. There was an error communicating with the server."); }); } } if (GUITools.Button(new Rect(30f, position.height - 42f - 22f, 120f, 32f), new GUIContent(LocalizedStrings.BackCaps), BlueStonez.button)) { this.Hide(); this.HideKeyboard(); PanelManager.Instance.OpenPanel(PanelType.Login); } GUI.enabled = true; GUI.EndGroup(); }