Пример #1
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            InputFunctions inputfuncs = new InputFunctions();
            FileFunctions  filefuncs  = new FileFunctions();
            string         email      = txtEmail.Text;

            if (!inputfuncs.verifyEmail(email))
            {
                MessageBox.Show("Please enter a valid email address");
            }
            else if (filefuncs.checkUser(email, "users.csv"))
            {
                string password = filefuncs.getField(email, 3, "users.csv");
                if (password == txtPassword.Text)
                {
                    this.Hide();
                    User.Name     = filefuncs.getField(email, 0, "users.csv");
                    User.Email    = email;
                    User.Password = password;
                    frmProfile profile = new frmProfile();
                    profile.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Invalid password.");
                }
            }
            else
            {
                MessageBox.Show("An account does not exist with that email address.");
            }
        }
Пример #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            FileFunctions filefuncs = new FileFunctions();
            string        username  = txtUsername.Text;

            if (filefuncs.checkUser(username, "admins.csv"))
            {
                string password = filefuncs.getField(username, 2, "admins.csv");
                if (password == txtPassword.Text)
                // Update user object and go to admin page if account exists and password matches.
                {
                    this.Hide();
                    User.Name     = filefuncs.getField(username, 0, "admins.csv");
                    User.Email    = username;
                    User.Password = password;
                    frmAdmin admin = new frmAdmin();
                    admin.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Invalid password.");
                }
            }
            else
            {
                MessageBox.Show("An account does not exist with this username.");
            }
        }
Пример #3
0
        private void btnCreate_Click(object sender, EventArgs e)
        {
            InputFunctions inputfuncs = new InputFunctions();
            FileFunctions  filefuncs  = new FileFunctions();

            if (!inputfuncs.verifyEmail(txtEmail.Text))
            {
                MessageBox.Show("Please enter a valid email address.");
            }
            else if (filefuncs.checkUser(txtEmail.Text, "users.csv"))
            {
                MessageBox.Show("An account already exists with this email address.");
            }
            else if (txtConfirm.Text != txtPassword.Text)
            {
                MessageBox.Show("Passwords must match!");
            }
            else
            {
                User.Name     = txtName.Text;
                User.Email    = txtEmail.Text;
                User.Age      = txtAge.Text;
                User.Password = txtPassword.Text;
                filefuncs.writeUser("users.csv");
                this.Hide();
                frmLogin login = new frmLogin();
                login.ShowDialog();
            }
        }
Пример #4
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            FileFunctions filefuncs = new FileFunctions();

            if (filefuncs.checkUser(txtUsername.Text, "admins.csv"))
            {
                MessageBox.Show("An account already exists with this username.");
            }
            else if (txtPassword.Text != txtConfirm.Text)
            {
                MessageBox.Show("Passwords must match.");
            }
            else
            {
                User.Name     = txtName.Text;
                User.Username = txtUsername.Text;
                User.Password = txtPassword.Text;
                filefuncs.writeUser("admins.csv");
                this.Hide();
                frmAdminLogin adminlogin = new frmAdminLogin();
                adminlogin.ShowDialog();
            }
        }