Ejemplo n.º 1
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            String username = UsernameTextBox.Text;
            String password = PasswordTextBox.Text;
            Form   msg;

            if (Program.LogIn(username, password))
            {
                msg = new LogInSuccess();
                msg.Show();
                form.HideLogInCreateAccountButtons();
            }
            else
            {
                msg = new LoginFail();
                msg.Show();
            }
            this.Close();
        }
Ejemplo n.º 2
0
        private void SubmitButton_Click(object sender, EventArgs e)
        {
            username       = UsernameTextBox.Text;
            password       = PasswordTextBox.Text;
            repeatPassword = RepeatPasswordTextBox.Text;

            //check if username is available
            if (Program.IsUsernameTaken(username))
            {
                ShowError("Username is taken.");
            }

            //check if password matched the template
            else if (!Program.ValidatePassword(password))
            {
                ShowError("Password does not match the template.");
            }

            //check if passwords are the same
            else if (password != repeatPassword)
            {
                ShowError("Passwords do not match.");
            }

            if (Program.CreateAccount(username, password))
            {
                Form msg = new WelcomeMsg();
                form.HideLogInCreateAccountButtons();
                msg.Show();
                this.Close();
            }
            else
            {
                ShowError("Something went wrong...");
            }
        }