public void showLogin() { if (CurrentUser.User == null) { loginForm = new loginForm(); //loginForm.MdiParent = this; loginForm.StartPosition = FormStartPosition.CenterScreen; loginForm.FormClosed += LoginForm_FormClosed; loginForm.Show(); } else { loginForm.Activate(); } }
private void submitOnClick(object sender, EventArgs e) { if (validated()) { byte[] data = System.Text.Encoding.ASCII.GetBytes(passwordText.Text); data = new System.Security.Cryptography.SHA256Managed().ComputeHash(data); String hash = System.Text.Encoding.ASCII.GetString(data); UserController.updatePassword(CurrentUser.User.userName, hash); MessageBox.Show("Your password was reset"); this.Hide(); var loginForm = new loginForm(); loginForm.Closed += (s, args) => this.Close(); loginForm.Show(); } }
//Defines action of the submit button private void btnSubmit_Click(object sender, EventArgs e) { if (validCredentials()) { byte[] data = System.Text.Encoding.ASCII.GetBytes(txtPassword.Text); data = new System.Security.Cryptography.SHA256Managed().ComputeHash(data); String hash = System.Text.Encoding.ASCII.GetString(data); this.phoneNumber = label17.Text + phone1.Text + label18.Text + phone2.Text + label10.Text + phone3.Text; string email = txtEmail1.Text + label16.Text + txtEmail2.Text + label19.Text + txtEmail3.Text; UserController.createUser(txtUser.Text, txtFirstName.Text, txtLastName.Text, email, this.phoneNumber, hash, hintText.Text); MessageBox.Show("Thank you for registering. Returning to login screen"); this.Hide(); var loginForm = new loginForm(); loginForm.Closed += (s, args) => this.Close(); loginForm.Show(); } }