예제 #1
0
파일: LOGIN.cs 프로젝트: K4sia/Library
        private void textBox2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string          user = textBox1.Text;
                string          pass = textBox2.Text;
                List <string>[] list;

                if (user == "")
                {
                    MessageBox.Show("wpisz login");
                }
                else if (pass == "")
                {
                    MessageBox.Show("wpisz haslo");
                }
                else if (user == "" && pass == "")
                {
                    MessageBox.Show("wpisz login i haslo");
                }
                else
                {
                    list = dbConnect.Login(user, pass);

                    //MessageBox.Show(list[1][0]);
                    //MessageBox.Show(list[0].Count().ToString());

                    if (list[0].Count() == 0)
                    {
                        MessageBox.Show("nie znaleziono uytkownika\nbadz haslo jest niepoprawne");
                    }

                    else if (list[0].Count() == 1)
                    {
                        if (list[1][0] == "1")
                        {
                            //MessageBox.Show("admin");
                            this.Hide();
                            Form1 admin = new Form1();
                            admin.ShowDialog();
                        }
                        else if (list[1][0] == "2")
                        {
                            //MessageBox.Show("user");
                            this.Hide();
                            UZYTKOWNIK uz = new UZYTKOWNIK();
                            uz.Show();
                        }
                    }
                }
            }
        }
예제 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string user = textBox1.Text;
            string pass = textBox2.Text;
            List<string>[] list;

            if (user == "")
            {
                MessageBox.Show("wpisz login");
            }
            else if (pass == "")
            {
                MessageBox.Show("wpisz haslo");
            }
            else if (user == "" && pass == "")
            {
                MessageBox.Show("wpisz login i haslo");
            }
            else
            {
                list = dbConnect.Login(user, pass);

                //MessageBox.Show(list[1][0]);
                //MessageBox.Show(list[0].Count().ToString());

                if (list[0].Count() == 0)
                {
                    MessageBox.Show("nie znaleziono uytkownika\nbadz haslo jest niepoprawne");
                }

                else if (list[0].Count() == 1)
                {
                    if (list[1][0] == "1")
                    {
                        //MessageBox.Show("admin");
                        this.Hide();
                        Form1 admin = new Form1();
                        admin.ShowDialog();

                    }
                    else if (list[1][0] == "2")
                    {
                        //MessageBox.Show("user");
                        this.Hide();
                        UZYTKOWNIK uz = new UZYTKOWNIK();
                        uz.Show();
                    }

                }

            }
        }
예제 #3
0
파일: LOGIN.cs 프로젝트: K4sia/Library
        private void button1_Click(object sender, EventArgs e)
        {
            string user = textBox1.Text;
            string pass = textBox2.Text;

            CreatePasswordHash(pass, CreateSalt(0));

            List<string>[] list;

            //haselko(pass);
            if (user == "")
            {
                MessageBox.Show("wpisz login");
            }
            else if (pass == "")
            {
                MessageBox.Show("wpisz haslo");
            }
            else if (user == "" && pass == "")
            {
                MessageBox.Show("wpisz login i haslo");
            }
            else
            {

                list = dbConnect.Login(user, hashedPwdglobal);
                list2 = dbConnect.ZalUzyt(user, hashedPwdglobal);
                //MessageBox.Show(list[1][0]);
                //MessageBox.Show(list[0].Count().ToString());

                if (list[0].Count() == 0)
                {
                    //Aby podejrzeć kodowanie hasła odkomentuj poniższe
                    //MessageBox.Show(hashedPwdglobal.ToString());
                    MessageBox.Show("nie znaleziono uzytkownika\nbadz haslo jest niepoprawne");
                }

                else if (list[0].Count() == 1)
                {
                    if (list[1][0] == "1")
                    {
                        //MessageBox.Show("admin");
                        this.Hide();
                        Form1 admin = new Form1();
                        admin.ShowDialog();

                    }
                    else if (list[1][0] == "2")
                    {
                        //MessageBox.Show("user");
                        this.Hide();
                        UZYTKOWNIK uz = new UZYTKOWNIK(user, hashedPwdglobal);
                        uz.Show();

                    }

                }

            }
        }