private void btnLogin_Click(object sender, EventArgs e) { if (validateLogin()) { if (tbUserName.Text.StartsWith("S")) { StudentApp frSTudent = new StudentApp(); frSTudent.studentId = tbUserName.Text.Trim(); this.Hide(); frSTudent.ShowDialog(); } else if (tbUserName.Text.StartsWith("T")) { TeacherApp frTeacher = new TeacherApp(); frTeacher.teacherId = tbUserName.Text.Trim(); this.Hide(); frTeacher.ShowDialog(); } else { Admin frAdmin = new Admin(); this.Hide(); frAdmin.ShowDialog(); } } }
private async void btnSave_Click(object sender, EventArgs e) { var salf = BCrypt.Net.BCrypt.GenerateSalt(12); var pass = BCrypt.Net.BCrypt.HashPassword(tbPassChange.Text.Trim(), salf); account.username = studentId; account.salf = salf; account.password = pass; var jsonAccount = JsonConvert.SerializeObject(account); var content = new StringContent(jsonAccount, Encoding.UTF8, "application/json"); var result = await client.PutAsync($@"{pathAccount}/{studentId}", content); this.Close(); MessageBox.Show("Changed Password Successfully", "Message"); StudentApp frStudent = new StudentApp(); frStudent.studentId = studentId; frStudent.Show(); }