Example #1
0
        private async void LogInButton_Click(object sender, EventArgs e)
        {
            if (!FormValidator.ValidateAll())
            {
                MessageBox.Show("Invalid data", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            try
            {
                UseWaitCursor = true;

                LogInForm logInForm = new LogInForm(LoginInput.Text, PasswordInput.Text);
                Program.DI.Resolve <Session>().Update(await Program.DI.Resolve <AuthController>().LogIn(logInForm));

                UseWaitCursor = false;

                ResetCredentials();
                EnterSystem();
            }
            catch (ResponseException ex)
            {
                UseWaitCursor = false;
                MessageBox.Show(ex.message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void logOutBtn_Click(object sender, EventArgs e)
        {
            this.Visible = false;
            LogInForm l1 = new LogInForm();

            l1.Visible = true;
        }
        public async Task <Session> LogIn(LogInForm logInForm)
        {
            IQuery          logInQuery = Program.DI.Resolve <LogInQueryFactory>().LogIn(logInForm);
            IServerResponse response   = await Program.DI.Resolve <IServerCommunicator>().SendQuery(logInQuery);

            return(Program.DI.Resolve <IResponseParser>().Parse <Session>(response));
        }
Example #4
0
    IEnumerator ShowNick(LogInForm form)
    {
        //클라이언트 -> 서버로
        string postData = JsonUtility.ToJson(form);

        byte[] sendData = Encoding.UTF8.GetBytes(postData);

        using (UnityWebRequest www = UnityWebRequest.Put("http://localhost:3000/users/shownick", postData))

        // 서버 -> 클라이언트

        {
            www.method = "POST";
            www.SetRequestHeader("Content-Type", "application/json");

            yield return(www.Send());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
            }
            else
            {
                string resultStr = www.downloadHandler.text;

                Debug.Log(www.downloadHandler.text);
                userInfoText.text = resultStr;
            }
        }
    }
Example #5
0
 //кнопка личный кабинет.
 private void pictureBox1_Click(object sender, EventArgs e)
 {
     if ((UserData.Login == null) && (UserData.Password == null))
     {
         LogInForm newForm = new LogInForm();
         newForm.Left = this.Left;
         newForm.Top  = this.Top;
         newForm.Show();
         this.Hide();
         //очистка корзины
         UserData.Bascket.CountProducts = 0;
         UserData.Bascket.OrderIdCount.Clear();
         UserData.Bascket.sum         = 0;
         UserData.Bascket.OrderString = null;
     }
     else
     {
         CabinetForm newForm = new CabinetForm();
         newForm.Left = this.Left;
         newForm.Top  = this.Top;
         newForm.Show();
         this.Hide();
         //очистка корзины
         UserData.Bascket.CountProducts = 0;
         UserData.Bascket.OrderIdCount.Clear();
         UserData.Bascket.sum         = 0;
         UserData.Bascket.OrderString = null;
     }
 }
        public void LogInSendEmail_DeleteViaRightMouseClick()
        {
            _homePage = new HomePage();

            _logInform = _homePage.OpenLoginForm();

            //Log in as first user
            _mainEmailBoxPage = _logInform.LogInToEmailBox(Constants.Sender, Constants.Password);

            _navigationPanel = new MainNavigationPanel();

            //Verify that login is successful

            bool isFirstLoginSuccessfull = _navigationPanel.IsElementVisible(_navigationPanel.InboxLink);

            Assert.IsTrue(isFirstLoginSuccessfull, $"Login of first user '{Constants.Sender}' was not successful");

            //Write and send an email
            _mainEmailBoxPage.SendEmail(Constants.Recipient, Constants.Message);

            _logInform = _mainEmailBoxPage.SignOut();

            _logInform.LogInToEmailBox(Constants.Recipient, Constants.Password);

            //Delete an email
            _mainEmailBoxPage.DeleteEmailViaRightClick(Constants.SenderName);
        }
        private void LogInMenuButton_Click(object sender, EventArgs e)
        {
            LogInForm logInForm = new LogInForm();

            logInForm.Show();
            this.Hide();
        }
        internal static CookieContainer Login(ushort sid)
        {
            CookieContainer cc = null;

            if (!string.IsNullOrWhiteSpace(Settings.Default.Cookies))
            {
                cc = (CookieContainer)HuntsHubConnection.ByteArrayToObject(Convert.FromBase64String(Settings.Default.Cookies));
            }
            while (!HuntsHubConnection.TestCC(cc))
            {
                Application.Current.Dispatcher.Invoke(delegate()
                {
                    LogInForm lif = new LogInForm(sid);
                    if (lif.ShowDialog().Value&& lif.receivedCookies.Count > 0)
                    {
                        cc = lif.receivedCookies;
                    }
                    if (lif.receivedCookies.Count == 0)
                    {
                        Environment.Exit(0);
                    }
                });
            }
            return(cc);
        }
Example #9
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DoubleAnimation logInHeightAnimation = new DoubleAnimation();

            logInHeightAnimation.From           = 0;
            logInHeightAnimation.To             = 300;
            logInHeightAnimation.Duration       = TimeSpan.FromSeconds(5);
            logInHeightAnimation.EasingFunction = new QuadraticEase();

            LogInFormRow.BeginAnimation(HeightProperty, logInHeightAnimation);


            ThicknessAnimation logoAnimation = new ThicknessAnimation();

            logoAnimation.From           = new Thickness(0, 80, 0, 0);
            logoAnimation.To             = new Thickness(0, 0, 0, 0);
            logoAnimation.Duration       = TimeSpan.FromSeconds(5);
            logoAnimation.EasingFunction = new QuadraticEase();
            logoAnimation.BeginTime      = TimeSpan.FromSeconds(3);

            LogoRow.BeginAnimation(MarginProperty, logoAnimation);


            DoubleAnimation logInOpacityAnimation = new DoubleAnimation();

            logInOpacityAnimation.From           = 0;
            logInOpacityAnimation.To             = 1;
            logInOpacityAnimation.Duration       = TimeSpan.FromSeconds(3);
            logInOpacityAnimation.EasingFunction = new QuadraticEase();
            logInOpacityAnimation.BeginTime      = TimeSpan.FromSeconds(4.5);

            LogInForm.BeginAnimation(OpacityProperty, logInOpacityAnimation);
        }
Example #10
0
        public async Task <IActionResult> Login([FromBody] LogInForm model)
        {
            if (!ModelState.IsValid || model == null)
            {
                return(BadRequest(ModelState));
            }

            var user = await _db.Users.AsNoTracking().FirstOrDefaultAsync(x => x.Email.Equals(model.Email, StringComparison.OrdinalIgnoreCase));

            if (user == null)
            {
                return(BadRequest(ControllerErrorCode.AccountOrPasswordWrong));
            }

            var salt = user.Salt;

            var passHash = user.PassHash;

            var cryptoProvider = new CryptographyProcessor();

            if (!cryptoProvider.AreEqual(model.Password, passHash, salt))
            {
                return(BadRequest(ControllerErrorCode.AccountOrPasswordWrong));
            }

            if (!user.IsConfirmed)
            {
                return(BadRequest(ControllerErrorCode.NotConfirmed));
            }

            var token = await _token.GetTokenAsync(user);

            return(Ok(token));
        }
Example #11
0
    //+++++ Login 코루틴
    IEnumerator Login(LogInForm form)
    {
        string postData = JsonUtility.ToJson(form);

        byte[] sendData = Encoding.UTF8.GetBytes(postData);

        using (UnityWebRequest www = UnityWebRequest.Put("http://localhost:3000/users/signin", postData))
        {
            www.method = "POST";
            www.SetRequestHeader("Content-Type", "application/json");

            yield return(www.Send());

            loginConfirmButton.interactable = true;
            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
            }
            else
            {
                string resultStr = www.downloadHandler.text;

                var result = JsonUtility.FromJson <LoginResult>(resultStr);

                if (result.result == 2)
                {
                    SceneManager.LoadScene("Game");
                }
                Debug.Log(www.downloadHandler.text);
            }
        }
    }
Example #12
0
        private void buy(Person person, Product product)
        {
            String response = "";

            response = Connect("buy:" + person.id + "=" + product.id);

            if (response == "debt")
            {
                errorTone.Play();
                LogInForm logIn = new LogInForm(adminArray);
                if (logIn.ShowDialog() == DialogResult.OK)
                {
                    Admin admin = logIn.getSelectedAdmin();

                    if (admin.pin.Equals(logIn.getPIN()))
                    {
                        //Succes
                        response          = Connect("forcebuy:" + person.id + "=" + product.id);
                        statusReport.Text = person.name + " kocht " + product.name;
                        succesTone.Play();
                    }
                    else
                    {
                        statusReport.Text = "Log In Faaaaal";
                        errorTone.Play();
                    }
                }
            }
            else if (response == "succes")
            {
                statusReport.Text = person.name + " kocht " + product.name;
                succesTone.Play();
            }
        }
Example #13
0
        private void Form1_Load(object sender, EventArgs e)
        {
            LogInForm login = new LogInForm();

            login.ShowDialog();

            LbUserId.Text = $"LOGIN : {Commons.USERID}";
        }
        public void GivenILogInToTheEmailBoxWithAnd(string login, string password)
        {
            LogInForm _logInform = new LogInForm();

            _logInform.LogInToEmailBox(login, password);
            Logger.Configure();
            Log.Information($"I login with the invalid credentials: {login} / {password}");
        }
        public void GivenINavigateToLoginForm()
        {
            HomePage  _homePage  = new HomePage();
            LogInForm _logInform = _homePage.OpenLoginForm();

            Logger.Configure();
            Log.Information("Login form is opened");
        }
Example #16
0
        private void timerLoadingScreen_Tick(object sender, EventArgs e)
        {
            timerLoadingScreen.Stop();
            LogInForm L = new LogInForm();

            this.Hide();
            L.Show();
        }
Example #17
0
        private void lblOut_Click(object sender, EventArgs e)
        {
            this.Hide();
            var ds = new LogInForm();

            ds.FormClosed += (s, args) => this.Close();
            ds.ShowDialog();
        }
Example #18
0
    public void OnClickShowNickButton()
    {
        LogInForm loginForm = new LogInForm();

        loginForm.username = loginManager.loginUsernameIF.text;
        loginForm.password = loginManager.loginPasswordIF.text;

        StartCoroutine(ShowNick(loginForm));
    }
Example #19
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            LogInForm main = new LogInForm();

            main.Show();
            Application.Run();
        }
Example #20
0
        public void ThenButtonShouldBeVisible()
        {
            By        composeButtonBy = By.XPath("//div[contains(text(),'COMPOSE')]");
            LogInForm logInForm       = new LogInForm();

            logInForm.WaitTillElementIsVisible(composeButtonBy);
            Logger.Configure();
            Log.Information("Compose button should be displayed");
        }
Example #21
0
        public void LogInSendEmailLogOut_LogInChechThatEmailIsSent()
        {
            // IHomePage _homePage = new HomePageDecorator(new HomePage());

            _logInform = _homePage.OpenLoginForm();

            //Log in as first user
            _logInform.LogInToEmailBox(Constants.Sender, Constants.Password);

            //Verify that login is successful
            _navigationPanel = new MainNavigationPanel();

            bool isFirstLoginSuccessfull = _navigationPanel.IsElementVisible(_navigationPanel.InboxLink);

            Assert.IsTrue(isFirstLoginSuccessfull, $"Login of first user '{Constants.Sender}' was not successful");

            //Write and send an email
            _mainEmailBoxPage.SendEmail(Constants.Recipient, Constants.Message);

            //Verify that email is in sent mail box
            _navigationPanel.SentMailLink.Click();

            _sentMailPage = new SentMailPage();

            bool isEmailInSentBox = _sentMailPage.IsElementVisible(_sentMailPage.RecipientName);

            Assert.IsTrue(isEmailInSentBox, "Email was not sent and is not resent in Sent Mail box");

            _logInform = _mainEmailBoxPage.SignOut();

            _logInform.LogInToEmailBox(Constants.Recipient, Constants.Password);

            //Verify that login is successful
            bool isSecondLoginSuccessfull = _navigationPanel.InboxLink.Displayed;

            Assert.IsTrue(isSecondLoginSuccessfull, $"Login of second user '{Constants.Recipient}' was not successful");

            //Verify that email is in Inbox
            bool isEmailInInbox = _sentMailPage.IsElementVisible(_sentMailPage.SenderName);

            Assert.IsTrue(isEmailInInbox, $"Email is not displayed in Inbox");

            //Drag&drop email to trash
            _mainEmailBoxPage.DeleteEmail(Constants.SenderName);

            //Verify that email is in the trash
            _navigationPanel.TrashButton.Click();

            _trashPage = new TrashPage();

            bool isEmailInTrash = _trashPage.IsElementVisible(_trashPage.SenderName);

            Assert.IsTrue(isEmailInInbox, $"Email is not displayed in Trash");
        }
Example #22
0
 public LogInForm()
 {
     InitializeComponent();
     LInForm           = this;
     _                 = new Data.CColor();
     _                 = new Data.Controls.FMainPanel.CLogInForm();
     _                 = new Data.Controls.FMainPanel.CLogInButton();
     LInForm.BackColor = Drawing.BackColor;
     LInForm.ForeColor = Drawing.ForeColor;
     //LInForm.Text = $"{LInForm.ClientSize.Width} x {LInForm.ClientSize.Height}";
 }
Example #23
0
        private void logoutToolStripMenuItem_Click_1(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure you want to log out?", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Question);


            if (result == DialogResult.Yes)
            {
                this.Hide();
                LogInForm obj = new LogInForm();
                obj.Show();
            }
        }
Example #24
0
        public async Task <SessionDto> LogIn(LogInForm logInForm)
        {
            string   salt           = Guid.NewGuid().ToString();
            string   passwordSalted = Hasher.GetHash(Hasher.GetHash(logInForm.Password) + salt);
            LogInDto dto            = new LogInDto(logInForm.Login, passwordSalted, salt);

            Session = await Server.SendPost <LogInDto, SessionDto>(
                ServerHolder.SERVER_URL + LOG_IN_ENDPOINT, dto
                );

            return(Session);
        }
Example #25
0
        public ActionResult LogIn(LogInForm logInForm)
        {
            if (!String.IsNullOrWhiteSpace(logInForm.Email) && !String.IsNullOrWhiteSpace(logInForm.Password) && !String.IsNullOrWhiteSpace(logInForm.AccountTypeId.ToString()))
            {
                if (logInForm.AccountTypeId == 0)
                {
                    User traveler = db.Users.Where(u => u.AccountType == 0).FirstOrDefault(u => u.Email == logInForm.Email);
                    if (traveler != null)
                    {
                        if (Crypto.VerifyHashedPassword(traveler.Password, logInForm.Password))
                        {
                            Session["LogInSuccess"] = true;
                            Session["User"]         = traveler;
                        }
                        else
                        {
                            Session["LogInError"] = true;
                            return(RedirectToAction("index"));
                        }
                    }
                    else
                    {
                        Session["LogInError"] = true;
                        return(RedirectToAction("index"));
                    }
                }

                if (logInForm.AccountTypeId == 1)
                {
                    User guide = db.Users.Where(u => u.AccountType == 1).FirstOrDefault(u => u.Email == logInForm.Email);
                    if (guide != null)
                    {
                        if (Crypto.VerifyHashedPassword(guide.Password, logInForm.Password))
                        {
                            Session["LogInSuccess"] = true;
                            Session["User"]         = guide;
                        }
                        else
                        {
                            Session["LogInError"] = true;
                            return(RedirectToAction("index"));
                        }
                    }
                    else
                    {
                        Session["LogInError"] = true;
                        return(RedirectToAction("index"));
                    }
                }
            }
            return(RedirectToAction("index"));
        }
        private async void TryLogIn()
        {
            LogInForm logInForm = new LogInForm()
            {
                Login = Profile.Login, Password = Profile.Password
            };
            bool success = await DependencyHolder.ServiceDependencies.Resolve <AuthService>().LogIn(logInForm);

            if (!success)
            {
                this.Close();
            }
        }
Example #27
0
        public void GivenILoginWithTheFollowingCredentials(Table table)
        {
            var user = new User(table.Rows[0][0], table.Rows[0][1]);

            ScenarioContext.Current.Add("Username", user);
            ScenarioContext.Current.Add("Password", user);
            HomePage  _homePage  = new HomePage();
            LogInForm _logInform = _homePage.OpenLoginForm();

            _logInform.LogInToEmailBox(user.Username, user.Password);
            Logger.Configure();
            Log.Information("I login with the following credentials: {Username} / {Password}", table.Rows[0][0], table.Rows[0][1]);
        }
Example #28
0
        public void ThenISeeErrorMessage()
        {
            By        errorMessage = By.XPath("//div[contains(text(),'Wrong password')]");
            LogInForm logInForm    = new LogInForm();

            logInForm.WaitTillElementIsVisible(errorMessage);

            bool doesErrorMessageDisplayed = logInForm.ErrorMessage.Displayed;

            Assert.IsTrue(doesErrorMessageDisplayed, $"Error message is not displayed after input incorrect password");

            Logger.Configure();
            Log.Information("Error message should be displayed");
        }
 public static void LogIn(LoginViewModel lvm)
 {
     if (AuthController.LogIn(lvm))
     {
         HomeForm.LogIn(lvm);
         LogInForm.Close();
         AdForm?.DetermineLoggedIn();
     }
     else
     {
         MessageBox.Show("Could not log you in with these credentials.",
                         "Authentication error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        public void GivenISignOut()
        {
            By signOutButtonBy = By.XPath("//a[text()='Sign out']");

            MainEmailBoxPage mainPage = new MainEmailBoxPage();

            mainPage.LinkToAccountPopUp.Click();
            mainPage.WaitTillElementIsVisible(signOutButtonBy);
            mainPage.SignOutButton.Click();

            LogInForm logInForm = new LogInForm();

            Logger.Configure();
            Log.Information($"I sign out");
        }