コード例 #1
0
        private void btn_Login_Click_1(object sender, EventArgs e)
        {
            Account_Service service     = new Account_Service();
            Account         currentUser = new Account();

            currentUser.Gebruikersnaam = txtbox_Gebruikersnaam.Text;
            string salt = service.GetSalt(currentUser);

            HashAndSalt retrieve = new HashAndSalt();
            string      hash     = retrieve.GenerateHash(txtbox_Wachtwoord.Text, salt);

            SqlConnection  con = new SqlConnection(@"Data Source=den1.mssql8.gear.host;Initial Catalog=pdb1920f6;Persist Security Info=True;User ID=pdb1920f6;Password=Lc9e~P-O3L2d");
            SqlDataAdapter sda = new SqlDataAdapter("SELECT COUNT(*) FROM ACCOUNT WHERE Gebruikersnaam ='" + txtbox_Gebruikersnaam.Text + "' AND Hash ='" + hash + "'", con);
            DataTable      dt  = new DataTable();

            sda.Fill(dt);
            if (dt.Rows[0][0].ToString() == "1")
            {
                this.Hide();
                SomerenUI UI = new SomerenUI();
                UI.Show();

                UI.GetUserName(txtbox_Gebruikersnaam.Text);
            }
            else
            {
                MessageBox.Show("Foute gebruikersnaam en/of wachtwoord..");
            }
        }
コード例 #2
0
        private void btnLogin_Click(object sender, EventArgs e)
        {
            SomerenLogic.Login_Service loginService = new SomerenLogic.Login_Service();
            List <Login> loginList = loginService.GetLogin();
            string       email     = txtUserName.Text;

            bool Isadmin = false;
            bool Isright = false;

            foreach (var s in loginList)
            {
                if ((s.UserName == txtUserName.Text) && (s.Password == txtPassword.Text))
                {
                    this.Hide();
                    if (s.Type == "admin")
                    {
                        Isadmin = true;
                    }
                    SomerenUI someren = new SomerenUI(Isadmin, $"{email}");
                    someren.ShowDialog();
                    this.Close();
                    break;
                }
                else
                {
                    Isright = true;
                }
            }
            if (Isright = true)
            {
                MessageBox.Show("Invalid user name or password!!!");
            }
        }
コード例 #3
0
 public DrankjeEditForm(ListViewItem t, SomerenUI summonedBy)
 {
     InitializeComponent();
     this.summonedBy                = summonedBy;
     this.DrinkIDInfoItem.Text      = t.SubItems[0].Text;
     this.DrinkNaamInfoItem.Text    = t.SubItems[1].Text;
     this.VerkochtInfoItem.Text     = t.SubItems[2].Text;
     this.VerkoopPrijsInfoItem.Text = t.SubItems[3].Text;
     this.VoorraadInfoItem.Text     = t.SubItems[4].Text.Split(' ')[0];
     this.AlcoholInfoItem.Text      = t.SubItems[5].Text;
     this.BTWInfoItem.Text          = t.SubItems[6].Text;
     this.SaveButton.Enabled        = false;
 }
コード例 #4
0
        //login
        // string[] usernames = {  "*****@*****.**", "rita @ infhaarlem.nl" };
        //string[] passwords = {  "t78Dx4BfhqfEamxdnAkLCpbC", "qd6VqFfyzF5UgPRDNy9NSCb4" };
        private void Login_Click(object sender, EventArgs e)
        {
            Login_Service    loginService = new Login_Service();
            List <LoginData> loginDatas   = loginService.GetLoginDatas();

            foreach (var lg in loginDatas)
            {
                if (lg.Username == UsernameBox.Text && lg.Password == PasswordBox.Text)
                {
                    SomerenUI s = new SomerenUI();
                    s.ShowDialog();
                    this.Hide();
                }
            }
        }
コード例 #5
0
 private void btn_Login_Click(object sender, EventArgs e)
 {
     if (textBox_Username.Text == AdminUsername && textBox_Password.Text == AdminPassword)
     {
         user.IsAdmin = true;
         SomerenUI UI = new SomerenUI(user);
         UI.Show();
     }
     else if (textBox_Username.Text == VisitorUsername && textBox_Password.Text == VisitorPassword)
     {
         user.IsAdmin = false;
         SomerenUI UI = new SomerenUI(user);
         UI.Show();
     }
     else
     {
         textBox_Username.Text = string.Empty;
         textBox_Password.Text = string.Empty;
         lbl_Warning.Show();
     }
 }
コード例 #6
0
        private void btn_RegisterConfirm_Click(object sender, EventArgs e)
        {
            //prep
            List <string> LicenceKey = new List <string>()
            {
                "XsZAb", "tgz3PsD", "qYh69un", "WQCEx"
            };
            bool      LicenceError = true;
            bool      PasswordsError = false;
            bool      EmptyError = false;
            bool      Isadmin = false;
            string    email, password = null, passwordchecker1, passwordchecker2, licence;
            Login_DAO login = new Login_DAO();

            //getting the email
            email = txt_RegisterEmailAddress.Text;

            //checking if everything is filled in
            if (string.IsNullOrWhiteSpace(txt_RegisterUsername.Text) | string.IsNullOrWhiteSpace(txt_RegisterPassword.Text) | string.IsNullOrWhiteSpace(txt_RegisterConfirmPassword.Text) | string.IsNullOrWhiteSpace(txt_RegisterLicenceKey.Text) | string.IsNullOrWhiteSpace(txt_RegisterEmailAddress.Text))
            {
                EmptyError = true;
            }

            //checking the licence
            licence = txt_RegisterLicenceKey.Text;
            foreach (var key in LicenceKey)
            {
                if (licence == key)
                {
                    LicenceError = false;
                    break;
                }
            }

            //checking the password
            passwordchecker1 = txt_RegisterPassword.Text;
            passwordchecker2 = txt_RegisterConfirmPassword.Text;
            if (passwordchecker1 != passwordchecker2)
            {
                PasswordsError = true;
            }
            else
            {
                password = passwordchecker1;
            }

            //confirming if everything is ok
            if (EmptyError == true)
            {
                lbl_RegisterError.Show();
                lbl_RegisterError.Text = "Error! Fill in all requirements";
            }
            else if (LicenceError == true && PasswordsError == true)
            {
                lbl_RegisterError.Show();
                lbl_RegisterError.Text = "Error! Invalid licence key and unsimilar passwords";
            }
            else if (LicenceError == true)
            {
                lbl_RegisterError.Show();
                lbl_RegisterError.Text = "Error! Invalid licence key";
            }
            else if (PasswordsError == true)
            {
                lbl_RegisterError.Show();
                lbl_RegisterError.Text = "Error! Passwords does not match";
            }
            else
            {
                //MessageBox.Show($"email= {email}\npassword= {password}");
                login.AddAccount($"{email}", $"{password}");
                this.Hide();
                SomerenUI someren = new SomerenUI(Isadmin, $"{email}");
                someren.ShowDialog();
                this.Close();
            }
        }