private void login() { if (Internals.validate(txtuser.Text) && Internals.validate(txtpass.Text))//make sure usertext and passtext is valid // i shouldve validated in internals but its too late now { if (txtuser.Text == Internals.grabusername() && Internals.hash(txtpass.Text, Internals.grabsalt()) == Internals.grabpassword()) { MessageBox.Show("Logged in!"); this.Hide(); //hide form MainForm frm = new MainForm(); //create new form main frm.Show(); //show it } else { MessageBox.Show("Please check your username/password!", "Invalid login credentials"); } } else { MessageBox.Show("Please check your username/password!", "Invalid login credentials"); } }
private void register() { if (Internals.validate(txtuser.Text) && Internals.validate(txtpass.Text)) //make sure usertext and passtext is valid // i shouldve validated in internals but its too late now { if (Internals.start(txtuser.Text, txtpass.Text) == true) //register user/pass { MessageBox.Show("Registered!"); this.Hide(); //hide form MainForm frm = new MainForm(); //create new form main frm.Show(); //show it } else { MessageBox.Show($"Welcome back, {Internals.grabusername()}!", "Welcome!"); this.Hide(); MainForm frm = new MainForm();//just in case if there is an erro frm.Show(); } } else { MessageBox.Show("Username & password must be at least 5 charcters"); }//im just gonna mess up on porpose }