Beispiel #1
0
        private async Task LoginAsync()
        {
            if (string.IsNullOrWhiteSpace(Login))
            {
                ShowToast("Login can't be empty");
                return;
            }

            if (string.IsNullOrWhiteSpace(Password))
            {
                ShowToast("Password can't be empty");
                return;
            }

            IsBusy = true;

            try
            {
                var result = await _authService.LoginAsync(Login, Password);

                if (!result.IsSuccess)
                {
                    ShowToast(result.GetFullMessage());
                    return;
                }

                SuccessLogin?.Invoke(this, EventArgs.Empty);
            }
            finally
            {
                IsBusy = false;
            }
        }
Beispiel #2
0
        public async void OnLogin()
        {
            if (this.IsBusy == true)
            {
                // Исключить повторную авторизации
                return;
            }

            if (!CheckUserInput())
            {
                return;
            }

            try
            {
                this.IsBusy = true;

                bool acceptSsl = sslSwitch.IsToggled;

                await App.Core.Connect(serverAddressInput.Text, loginInput.Text, passwordInput.Text, acceptSsl);

                this.IsBusy = false;

                SuccessLogin?.Invoke(this, EventArgs.Empty);
            }
            catch (Exception exc)
            {
                BugReportService.HandleException(Droid.Resources.Messages.LoginPage_Error_Connect_to_Server, exc.Message, exc);
            }
            finally
            {
                this.IsBusy = false;
            }
        }
Beispiel #3
0
        protected override async void OnAppearing()
        {
            if (!string.IsNullOrEmpty(AppDataStorage.Uri) && !string.IsNullOrEmpty(AppDataStorage.Token))
            {
                this.IsBusy = true;
                this.onLoginButton.IsEnabled = false;

                try
                {
                    // Скрываем логин и пароль, так как мы входим по токену.
                    ShowPasswordControls(false);

                    await this.coreService.ConnectToken(AppDataStorage.Uri, AppDataStorage.Token);

                    SuccessLogin?.Invoke(this, EventArgs.Empty);
                }
                catch (Exception exc)
                {
                    // Произошла ошибка входа, попробуем войти с помощью логина и пароля.

                    ShowPasswordControls(true);

                    BugReportService.HandleException(Droid.Resources.Messages.LoginPage_Error_Connect, exc.Message, exc);
                }
                finally
                {
                    this.IsBusy = false;
                    this.onLoginButton.IsEnabled = true;
                }
            }
        }
 private void _onLogin(LoginInfo loginInfo)
 {
     if (loginInfo.IsLogin)
     {
         MyInfo.PlayerID = loginInfo.PlayerID;
         SuccessLogin?.Invoke(this, EventArgs.Empty);
     }
     FailLogin?.Invoke(this, EventArgs.Empty);
 }
Beispiel #5
0
 public ActionResult Success(LoginModels login)
 {
     // Originates from WinForms.
     if (Request.ServerVariables["HTTP_USER_AGENT"].Contains("WOW64"))
     {
         var results = new SuccessLogin();
         results.user_email    = login.user_email;
         results.user_password = login.user_password;
         return(View(results));
     }
     else
     {
         return(View());
     }
 }
Beispiel #6
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("# IsLoginAllowed:");
            sb.AppendLine(IsLoginAllowed.ToString());
            sb.AppendLine("# IsLoggingIn:");
            sb.AppendLine(IsLoggingIn.ToString());
            sb.AppendLine("# SuccessLogin:"******"# Name:");
            sb.AppendLine(NameOrEmail);
            sb.AppendLine("# NameError:");
            sb.AppendLine(NameOrEmailError);
            sb.AppendLine("# Password:"******"# PasswordError:");
            sb.AppendLine(PasswordError);
            sb.AppendLine(base.ToString());
            return(sb.ToString());
        }