private void btnSubmitForgotPassword_Click(object sender, EventArgs e) { // get the email, password and repeated password SomerenLogic.Register_Service register_Service = new SomerenLogic.Register_Service(); string email = lblForgottenEmail.Text; string password = txtForgotPassword.Text; string repeatPassword = txtForgotRepeatPassword.Text; // check passwords match if (password != repeatPassword) { MessageBox.Show("passwords dont match"); return; } // validate password if (!ValidatePassword(password)) { return; } // update password register_Service.updateUserPassword(email, SHA512(password)); MessageBox.Show("Updated password and succesfully logged in"); // hide these menus en show application menuStrip2.Hide(); pnl_ForgotPasswordPanel.Hide(); pnl_Login.Hide(); pnl_Register.Hide(); role = register_Service.GetRole(email); menuStrip1.Show(); pnl_Dashboard.Show(); }
private void btnLogin_Click(object sender, EventArgs e) { SomerenLogic.Register_Service register_Service = new SomerenLogic.Register_Service(); // get the email and password from textboxes string email = txtLoginEmail.Text; string password = txtLoginPassword.Text; // validate the user // if validuser then show application and hide login and register and password forgotten if (register_Service.CheckUserLogin(email, SHA512(password))) { role = register_Service.GetRole(email); menuStrip2.Hide(); pnl_Login.Hide(); menuStrip1.Show(); pnl_Dashboard.Show(); } else { MessageBox.Show("Wrong email or password!"); // show messagebox with message, application keeps running return; } }