コード例 #1
0
ファイル: pinWindow.cs プロジェクト: ikwabe/UdoRead
        //a function to verify the password
        private void pwdTextBox_OnValueChanged(object sender, EventArgs e)
        {
            if (pwdTextBox.Text == pwd)
            {
                pwdTextBox.Enabled = false;

                dashBoard dshb = new dashBoard();
                this.Close();
                dshb.Show();
                inbonTab.check  = true;
                dashBoard.check = true;
            }
        }
コード例 #2
0
ファイル: login.cs プロジェクト: ikwabe/UdoRead
        //password
        private void pwd_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                MySqlConnection con = new MySqlConnection();
                con.ConnectionString = dbConnection;
                string       signIn = "select user_id, email, password,username,secword,fname,lname from users where username = '******' and password = '******'";
                MySqlCommand com    = new MySqlCommand(signIn, con);
                try
                {
                    con.Open();

                    MySqlDataReader reader;
                    DataTable       table = new DataTable();
                    if (txt.Text == "")
                    {
                        label3.Text = "Username field can not be empty.";
                    }
                    else if (pwd.Text == "")
                    {
                        label3.Text = "Password field can not be empty.";
                    }
                    else
                    {
                        //checking the database
                        reader = com.ExecuteReader();
                        table.Load(reader);
                        reader.Close();

                        if (table.Rows.Count > 0)
                        {
                            pwd.Enabled = false;
                            if (table.Rows[0][4] == null || table.Rows[0][4] == DBNull.Value)
                            {
                                MessageBox.Show("Please remember to set your SECRET WORD for password recovery and security purposes.");
                                //capturing user id for public purposes
                                user_id    = table.Rows[0][0].ToString();
                                user_email = table.Rows[0][1].ToString();
                                fullname   = table.Rows[0][5].ToString() + " " + table.Rows[0][6].ToString();
                                this.Hide();
                                dashBoard dsb = new dashBoard();
                                dsb.Show();
                            }
                            else
                            {
                                //capturing user id for public purposes
                                user_id    = table.Rows[0][0].ToString();
                                user_email = table.Rows[0][1].ToString();
                                fullname   = table.Rows[0][5].ToString() + " " + table.Rows[0][6].ToString();
                                this.Hide();
                                dashBoard dsb = new dashBoard();
                                dsb.Show();
                            }
                        }
                        else
                        {
                            label3.Text = "You have enterd a wrong Password or Username";
                        }
                    }
                }
                catch (MySqlException ex)
                {
                    MessageBox.Show(ex.Message);
                }
                con.Close();
            }
            else
            {
            }
        }