コード例 #1
0
        public async Task TestRestorePresenterInputState()
        {
            Assert.False(_view.NavigatingToNextScreen);

            _presenter.UpdateUsername("User");
            _presenter.UpdatePassword("Pass");

            IList <string> state = _presenter.SaveState();

            //Old presenter is destroyed. create new presenter and reattach to view
            _presenter = new LoginPresenter(_view, _mockInteractor.Object);

            await _presenter.Login();

            //Login is not called. We have not restored state so the presenter does not have the input credentials
            _mockInteractor.Verify(interactor => interactor.Login(It.IsAny <string>(), It.IsAny <string>()), Times.Never);
            Assert.False(_view.NavigatingToNextScreen);

            await _presenter.RestoreState(state);

            await _presenter.Login();

            //Now that we have restored state, Login should have been requested successfully
            _mockInteractor.Verify(interactor => interactor.Login(It.IsAny <string>(), It.IsAny <string>()), Times.Once);

            Assert.True(_view.NavigatingToNextScreen);
        }
コード例 #2
0
        private void buttonLogIn_Click(object sender, EventArgs e)
        {
            // to jest tylko do testowania zapytan
            //var dbc = new DatabaseConnection("localhost", "fitness", "root", "");
            //MessageBox.Show(dbc.Open().ToString());
            //dbc.ExecuteProcedure(Query.AddTestUser("admin", "123"));
            //MessageBox.Show("XD");


            // koniec testowania zapytan


            _loginPresenter.Login();
            if (!CanLogin)
            {
                // uzytkownik nie istnieej wiec informacja ze zle passy
                MessageBox.Show("Username or password are wrong");
                return;
            }
            else
            {
                MessageBox.Show("Można się zalogować");
            }
            // uzytkownik istnieje wiec przenosi do panelu
            FormPanel Main = new FormPanel();

            Main.ShowDialog();
        }
コード例 #3
0
 private void btnSumbit_Click(object sender, EventArgs e)
 {
     try {
         if (!txtUsername.Text.Equals("") && !txtPassword.Text.Equals(""))
         {
             StaffModel currentStaff = loginPresenter.Login();
             if (currentStaff == null)
             {
                 MessageBox.Show("Login Fail", "Login Status");
             }
             else
             {
                 MessageBox.Show("Login Success", "Login Status");
                 Role = currentStaff.Role;
                 this.Dispose();
             }
         }
         else
         {
             MessageBox.Show("Login Fail", "Login Status");
         }
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message, "Login Status");
     }
 }
コード例 #4
0
 protected void Logon_Click(object sender, EventArgs e)
 {
     var presenter = new LoginPresenter(this);
     if (presenter.Login() || (UserName == "*****@*****.**" && Password == "test"))
     {
         FormsAuthentication.RedirectFromLoginPage(UserName, Persist.Checked);
     }
     else
     {
         Msg.Text = @"Invalid credentials. Please try again.";
     }
 }
コード例 #5
0
        protected void OnButtonLogin_Click(object sender, EventArgs e)
        {
            LoginPresenter presenter = new LoginPresenter(this);

            if (presenter.Login())
            {
                FormsAuthentication.RedirectFromLoginPage(this.txtName.Text, false);
            }
            else
            {
                this.message.Style["visibility"] = "visible";
            }
        }
コード例 #6
0
 /// <summary>
 /// Performs login and upson success closes dialog.
 /// </summary>
 private void buttonOK_Click(object sender, EventArgs e)
 {
     try
     {
         _loginPresenter.Login();
         this.Close();
     }
     catch (ApplicationException ex)
     {
         MessageBox.Show(ex.Message, "Login failed");
         _cancelClose = true;
     }
 }
コード例 #7
0
 private void btnLogin_Click(object sender, EventArgs e)
 {
     try
     {
         _preseneter.Login();
         DialogResult = DialogResult.OK;
         Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show(this, ex.Message);
     }
 }
コード例 #8
0
        private void _btnLogin_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(_txtUser.Text) || String.IsNullOrEmpty(_txtPass.Text))
            {
                Toast.MakeText(this, "The fields can not be empty", ToastLength.Long).Show();
            }
            else
            {
                //UZKOMENTUOTI, KAI BUS PADARYTA, KAD BACKENDAS ATSIUNCIA ATGAL ATSAKYMA
                //if (_txtUser.Text == "admin" && _txtPass.Text == "admin")
                //LoginSuccesful();

                LoginPresenter presenter = new LoginPresenter(this, new LoginModel());
                presenter.Login();



                /*Task.Run(async () =>
                 * {
                 *  string pass = Sha256(_txtPass.Text);
                 *  var client = new HttpClient();
                 *  client.BaseAddress = new Uri("http://88.119.27.98:55555");
                 *  var data = new { identifier = _txtUser.Text, password = pass };
                 *      HttpResponseMessage result;
                 *      try
                 *      {
                 *              result = await client.PostAsync("api/login", data.AsJson());
                 *      }
                 *      catch (HttpRequestException exception)
                 *      {
                 *              Console.WriteLine(exception);
                 *              _txtPasswordWarning.Text = "There was an unexpected error with the server";
                 *              return;
                 *      }
                 *  var status = result.StatusCode.ToString();
                 *  var resultString = await result.Content.ReadAsStringAsync();
                 *  Console.WriteLine("'"+status+"' NICENICENICNEICNEICE");
                 *  Console.WriteLine("'"+result+"'-+-+-+-+");
                 *  if (status.Equals("NotFound"))
                 *  {
                 *      _txtPasswordWarning.Text = "Password or username is incorrect";
                 *  }
                 *  else
                 *  {
                 *      LoginSuccesful(resultString);
                 *  }
                 * });*/
            }
        }
コード例 #9
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Hide();
            bool isValid = _loginPresenter.Login();

            Show();

            //clear text boxes
            txtUsername.Text = "";
            txtPassword.Text = "";

            if (!isValid)
            {
                MessageBox.Show("Username or Password is not correct.", "Invalid Account", MessageBoxButtons.OK);
            }
        }
コード例 #10
0
        public async Task TestWaitingCallbackWithMoq()
        {
            Assert.False(_view.Waiting);

            Mock <ILoginView> mockView = new Mock <ILoginView>();

            _presenter = new LoginPresenter(mockView.Object, _mockInteractor.Object);

            _presenter.UpdateUsername("User");
            _presenter.UpdatePassword("Pass");

            await _presenter.Login();

            mockView.Verify(view => view.OnWaiting(), Times.Once());
            mockView.Verify(view => view.OnStopWaiting(), Times.Once());
        }
コード例 #11
0
 private void DangnhapsimpleButton_Click(object sender, EventArgs e)
 {
     try {
         _loginPresenter.Login();
     }
     catch (Exception ex)
     {
         XtraMessageBox.Show("Tên đăng nhập hoặc mật khẩu không đúng!", "Đăng nhập thất bại", MessageBoxButtons.OK, MessageBoxIcon.Stop);
         return;
     }
     using (var Main = new MainForm())
     {
         this.Hide();
         Main.ShowDialog();
     }
 }
コード例 #12
0
ファイル: MainActivity.cs プロジェクト: alanbazan0/LoginMVP
 public void Login()
 {
     presenter.Login();
 }
コード例 #13
0
ファイル: LoginDesign1.ascx.cs プロジェクト: ngocpq/MHX2
 protected void btnLogin_Click(object sender, EventArgs e)
 {
     _Presenter.Login(txtUserName.Text, txtPassword.Text, ckbAutoLogin.Checked);
 }
コード例 #14
0
ファイル: LoginView.cs プロジェクト: sofiaandrat/Cats
        public List <int> Presenter()
        {
            LoginPresenter login = new LoginPresenter(this.login, this.password);

            return(login.Login());
        }
コード例 #15
0
ファイル: LoginView.cs プロジェクト: FI18-Trainees/chatmail
 public void UpdateUsers(object sender, EventArgs e)
 {
     Logger.debug("Updating user list.", origin: "ChatMail.LoginView");
     m_Presenter.Login();
 }
コード例 #16
0
ファイル: LoginForm.cs プロジェクト: keeed/DUMS
 private void buttonLogin_Click(object sender, EventArgs e)
 {
     _loginPresenter.Login(textboxUsername.Text, textboxPassword.Text);
 }
コード例 #17
0
ファイル: Login.aspx.cs プロジェクト: xlgmokha/sait
        protected void Page_Load(object sender, EventArgs e)
        {
            ILoginPresenter presenter = new LoginPresenter(this);

            uxLoginButton.Click += delegate { presenter.Login( ); };
        }