private void btnCreateAccount_Click(object sender, EventArgs e)
        {
            this.Hide();
            RegisterForm newRegisterForm = new RegisterForm();

            newRegisterForm.ShowDialog();
        }
예제 #2
0
        public void RegisterPasswordShort()
        {
            RegisterForm register = new RegisterForm();

            if (register.Password == "12" && register.PasswordConfirm == "12")
            {
                Assert.IsTrue(false);
            }
        }
예제 #3
0
        public void RegisterWithoutMail()
        {
            RegisterForm register = new RegisterForm();

            if (register.Mail == "")
            {
                Assert.IsTrue(false);
            }
        }
예제 #4
0
        public void ConfirmPasswordFalse()
        {
            RegisterForm register = new RegisterForm();

            if (register.Password != register.PasswordConfirm)
            {
                Assert.IsTrue(false);
            }
        }
예제 #5
0
        public void ConfirmPassword()
        {
            RegisterForm register = new RegisterForm();

            if (register.Password == register.PasswordConfirm)
            {
                Assert.IsTrue(true);
            }
        }
예제 #6
0
        public void RegisterPasswordIsCorrect()
        {
            RegisterForm register = new RegisterForm();

            if (register.Password == "Pa$$w0rd" && register.PasswordConfirm == "Pa$$w0rd")
            {
                Assert.IsTrue(true);
            }
        }
예제 #7
0
        private void btnRegister_Click(object sender, EventArgs e)
        {
            bool acceptedRequest = true;

            mail            = txtMail.Text;
            pseudo          = txtPseudo.Text;
            password        = txtPassword.Text;
            passwordComfirm = txtComfirmPassword.Text;

            if (password.Length < 6)
            {
                lblError.Text   = "You password is too weak";
                acceptedRequest = false;
            }
            if (password != passwordComfirm)
            {
                lblError.Text   = "You passwords does not match";
                acceptedRequest = false;
            }
            if (password == "")
            {
                lblError.Text   = "You must enter a password";
                acceptedRequest = false;
            }
            if (passwordComfirm == "")
            {
                lblError.Text   = "You must a password AND a comfirm password";
                acceptedRequest = false;
            }
            if (pseudo == "")
            {
                lblError.Text   = "You must enter a pseudo";
                acceptedRequest = false;
            }
            if (!IsValidEmail(mail))
            {
                lblError.Text   = "Your mail address is not valid";
                acceptedRequest = false;
            }
            if (mail == "")
            {
                lblError.Text   = "You must enter a mail address";
                acceptedRequest = false;
            }

            if (acceptedRequest == true)
            {
                if (Register.CreateUser(mail, pseudo, password))
                {
                    this.Hide();
                    GameForm newGameForm = new GameForm(mail);
                    newGameForm.ShowDialog();
                }
                else
                {
                    this.Hide();
                    RegisterForm newRegisterForm = new RegisterForm();
                    newRegisterForm.ShowDialog();
                }
            }
            else
            {
                lblError.Visible = true;
            }
        }