private void Button2_Click(object sender, EventArgs e) { WindowsFormsApp2.SignUp sg = new WindowsFormsApp2.SignUp(); this.Hide(); sg.ShowDialog(); this.Close(); }
private void button1_Click(object sender, EventArgs e) { //Form3 main = new Form3(); //this.Hide(); //main.ShowDialog(this); WindowsFormsApp2.SignUp su = new WindowsFormsApp2.SignUp(); if (textBox1.Text == "") { MessageBox.Show("Username cannot be empty!"); } else if (textBox2.Text == "") { MessageBox.Show("Password cannot be empty!"); } else { int flag = 0; String databasePass = ""; query = "select * from signup where username='******' "; cmd = new OracleCommand(query, con); con.Open(); rd = cmd.ExecuteReader(); while (rd.Read()) { databasePass = rd["password"].ToString(); flag = 1; } rd.Close(); con.Close(); if (flag == 0) { MessageBox.Show("Username doesn't exist! Please try again!"); textBox1.Text = ""; textBox2.Text = ""; textBox1.Focus(); } // change this to accomodate ith hashing // textbox2.text should be hashed and matched with str // 1. Find the username and his corresponding salt // 2. concatenate the salt with textbox pass and hash // 3. compare hash with signup hash else if (su.GenerateSHA512Hash(textBox2.Text, getSalt(textBox1.Text)) == databasePass) { MessageBox.Show("Login Successfull!"); Form3 mm = new Form3(); this.Hide(); mm.ShowDialog(); this.Close(); } else { MessageBox.Show("Username and Password doesn't match! Please enter correct username and password"); } } }