예제 #1
0
파일: HomePage.cs 프로젝트: subodh6/NOV
        public void EnterUserDetails()
        {
            string password = TestData.RandomPassword();

            if (Username.Displayed)
            {
                Username.Clear();
                Username.SendKeys(TestData.RandomUserName());
                Console.WriteLine(Username.GetAttribute("value"));
            }
            if (Password.Displayed)
            {
                Password.Clear();
                Password.SendKeys(password);
                Console.WriteLine(Password.GetAttribute("value"));
            }
            if (ConfirmPassword.Displayed)
            {
                ConfirmPassword.Clear();
                ConfirmPassword.SendKeys(password);
                Console.WriteLine(ConfirmPassword.GetAttribute("value"));
            }
            if (SubmitButton.Displayed)
            {
                SubmitButton.Click();
                Thread.Sleep(5000);
            }
        }
예제 #2
0
 public void SuccessfullPasswordChange()
 {
     NavigateTo();
     OldPassword.Clear();
     OldPassword.SendKeys("1234");
     NewPassword.Clear();
     NewPassword.SendKeys("123456");
     ConfirmPassword.Clear();
     ConfirmPassword.SendKeys("123456");
     ChangePasswordButton.Click();
 }
예제 #3
0
 public void EnterMissmatchingNewPassword()
 {
     NavigateTo();
     OldPassword.Clear();
     OldPassword.SendKeys("1234");
     NewPassword.Clear();
     NewPassword.SendKeys("123456");
     ConfirmPassword.Clear();
     ConfirmPassword.SendKeys("12345");
     ChangePasswordButton.Click();
 }
예제 #4
0
 public void EnterIncorrectCurrentPasswordChange()
 {
     NavigateTo();
     OldPassword.Clear();
     OldPassword.SendKeys("12345");
     NewPassword.Clear();
     NewPassword.SendKeys("123456");
     ConfirmPassword.Clear();
     ConfirmPassword.SendKeys("123456");
     ChangePasswordButton.Click();
 }
예제 #5
0
 public void Register()
 {
     Driver.Navigate().GoToUrl(this.url + "/Account/Register");
     Email.Clear();
     Email.SendKeys("*****@*****.**");
     FullName.Clear();
     FullName.SendKeys("Test User");
     Password.Clear();
     Password.SendKeys("1234");
     ConfirmPassword.Clear();
     ConfirmPassword.SendKeys("1234");
     RegisterSubmitButton.Click();
 }
        private void Button_Click_SaveChanges(object sender, RoutedEventArgs e)
        {
            using (var context = new EverydayJournalContext())
            {
                //Getting current values of the text boxes
                var username             = UsernameChange.Text;
                var email                = EmailChange.Text;
                var password             = Password.Password;
                var passwordConfirmation = ConfirmPassword.Password;
                //Getting user from DB
                var userPassword = context.People.Find(LoggerUtility.UserId);

                if (password == passwordConfirmation &&
                    userPassword?.Password == password &&
                    username.Length > 3 &&
                    email.Length > 3)
                {
                    try
                    {
                        //Updating the user
                        userPassword.Name  = username;
                        userPassword.Email = email;

                        context.SaveChanges();

                        MessageBox.Show("Successfully updated information!");

                        UserHomePage userHomePage = new UserHomePage();
                        this.NavigationService?.Navigate(userHomePage);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Please, try again with correct information!");
                        EmailChange.Clear();
                        UsernameChange.Clear();
                        Password.Clear();
                        ConfirmPassword.Clear();
                    }
                }
                else
                {
                    MessageBox.Show(
                        "Invalid data. Please, try with correct password and Username/Email greater than 4 symbols!");
                }
            }
        }
예제 #7
0
        public string AddUser(UserRole role, string employeeName, string userName, Status status, string password)
        {
            SelectElement select = new SelectElement(Role);

            select.SelectByText(role.ToString());

            EmployeeName.Clear();
            EmployeeName.SendKeys(employeeName);

            UserName.Clear();
            UserName.SendKeys(userName);

            select = new SelectElement(Status);
            select.SelectByText(status.ToString());

            Password.Clear();
            Password.SendKeys(userName);

            ConfirmPassword.Clear();
            ConfirmPassword.SendKeys(userName);

            SaveBtn.Click();

            try
            {
                return(string.Format("Error validating employee name: {0}", EmpNameValidationError.Text));
            }
            catch (NoSuchElementException) { }

            try
            {
                return(string.Format("Error validating user name: {0}", UsrNameValidationError.Text));
            }
            catch (NoSuchElementException) { }

            return("Success");
        }
예제 #8
0
 public void Button_Click(object sender, RoutedEventArgs e)
 {
     if (FirstName.Text.Length > 0 && LastName.Text.Length > 0 && Email.Text.Length > 0)
     {
         if (FirstName.Text.Equals(LastName.Text))
         {
             MessageBox.Show("FirstName and LastName should be different");
         }
         else
         {
             if (Password.Text.Equals(ConfirmPassword.Text))
             {
                 if (Password.Text.Length >= 5)
                 {
                     MessageBox.Show($"Data Added Succefully");
                     FirstName.Clear();
                     LastName.Clear();
                     Email.Clear();
                     Password.Clear();
                     ConfirmPassword.Clear();
                 }
                 else
                 {
                     MessageBox.Show("Please Enter at least 5 values for Password");
                 }
             }
             else
             {
                 MessageBox.Show("Password and ConfirmPassword are not same");
             }
         }
     }
     else
     {
         MessageBox.Show("Please Enter All Values");
     }
 }
예제 #9
0
 public void FillConfirmPasswordMissmatch()
 {
     ConfirmPassword.Clear();
     ConfirmPassword.SendKeys("12345");
 }
예제 #10
0
 public void FillConfirmPassword()
 {
     ConfirmPassword.Clear();
     ConfirmPassword.SendKeys("1111");
 }
예제 #11
0
        private async void SaveNewPassword()
        {
            SaveLabel.Focusable = true;
            SaveLabel.Focus();
            SaveLabel.Focusable = false;

            if (Password.IsEnabled)
            {
                this.Close();
            }

            var flag = true;

            if (NewPassword.Password.Equals(string.Empty))
            {
                flag = false;
                BadNewPassword.BorderBrush = Brushes.Red;
            }

            if (ConfirmPassword.Password.Equals(string.Empty))
            {
                flag = false;
                BadConfirmPassword.BorderBrush = Brushes.Red;
            }

            if (!flag)
            {
                BadLabel.Content    = "Заполните обязательные поля";
                BadLabel.Visibility = Visibility.Visible;
                return;
            }

            if (NewPassword.Password != ConfirmPassword.Password)
            {
                NewPassword.Clear();
                ConfirmPassword.Clear();
                NewPassword.Focus();
                BadLabel.Content    = "Пароли не совпадают";
                BadLabel.Visibility = Visibility.Visible;
                return;
            }

            if (NewPassword.Password == Password.Password)
            {
                NewPassword.Clear();
                ConfirmPassword.Clear();
                NewPassword.Focus();
                BadLabel.Content    = "Пароль уже используется";
                BadLabel.Visibility = Visibility.Visible;
                return;
            }

            //rep.EditPass(NewPassword.Password);
            rep.GetPass = GlobalVars.GetHashCode(NewPassword.Password);
            // EncDecHelper.SetPassword(NewPassword.Password);


            await this.ShowMessageAsync(string.Empty, "Password has changed.");

            this.Close();
        }
예제 #12
0
 private void ClearAll()
 {
     oldPassword.Clear();
     newPassowrd.Clear();
     ConfirmPassword.Clear();
 }
예제 #13
0
        private void Create_user_Click(object sender, EventArgs e)
        {
            if (Password.Text != ConfirmPassword.Text)
            {
                MessageBox.Show("Pola password i confirm password różnią się od siebie");
                Password.Clear();
                ConfirmPassword.Clear();
            }
            if (Password.Text.Length < 4)
            {
                MessageBox.Show("Hasło musi zawierać conajmniej cztery znaki ");
                Password.Focus();
                Password.Clear();
                ConfirmPassword.Clear();
            }

            if (Program.IsValid(email.Text) == false)
            {
                MessageBox.Show("Podałeś zły format adresu e-mail");
            }

            if (Program.Regexcheck(Imie.Text, "@*[A-Z][a-z]+") == false && Program.Regexcheck(Nazwisko.Text, "@*[A-Z][a-z]+") == false)
            {
                MessageBox.Show("Zle imie ,albo nazwisko");
            }

            if (Program.Regexcheck(telefon.Text, "@*[0-9]") == false && telefon.Text.Length < 9)
            {
                MessageBox.Show("Zly numer telefonu");
            }



            try
            {
                SqlConnection con = new SqlConnection(Program.constring);


                con.Open();

                string insert = "insert into [User] (Username,Password,ROLE,Imie,Nazwisko,Telefon,e-mail) values (@usr,@pwd,@usrl,@Imie,@Nazwisko,@Telefon,@email)";
                cmd = new SqlCommand(insert, con);
                cmd.Parameters.Add(new SqlParameter("@usr", SqlDbType.VarChar)).Value      = Username.Text;
                cmd.Parameters.Add(new SqlParameter("@pwd", SqlDbType.VarChar)).Value      = Password.Text;
                cmd.Parameters.Add(new SqlParameter("@usrl", SqlDbType.VarChar)).Value     = cmbRole.Text;
                cmd.Parameters.Add(new SqlParameter("@Imie", SqlDbType.VarChar)).Value     = Imie.Text;
                cmd.Parameters.Add(new SqlParameter("@Nazwisko", SqlDbType.VarChar)).Value = Nazwisko.Text;
                cmd.Parameters.Add(new SqlParameter("@Telefon", SqlDbType.Int)).Value      = telefon.Text;
                cmd.Parameters.Add(new SqlParameter("@email", SqlDbType.VarChar)).Value    = email.Text;
                // cmd.Parameters.Add(new SqlParameter("@emp_id", SqlDbType.VarChar)).Value = txtEmp.Text;
                cmd.ExecuteNonQuery();
                MessageBox.Show("User registered successfully...!", "New User", MessageBoxButtons.OK, MessageBoxIcon.Information);

                cmd.Dispose();
                con.Close();
                bind();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }