private void logout_btn_Click(object sender, RoutedEventArgs e) { MessageBoxResult result = MessageBox.Show("Anda Yakin Ingin Logout", "Konfirmasi", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { result = MessageBox.Show("Yakin???", "Konfirmasi", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { LoginWindow login = new LoginWindow(); login.Show(); this.Close(); } else { } } else { } }
private void changePassButton_Click(object sender, RoutedEventArgs e) { string userName = textBoxEmail.Text; string tokenBox = textBoxToken.Password; if (myContext.Users.Any(a => a.UserName == userName)) { var passChange = myContext.Users.Where(m => m.UserName == userName).Single(); if (passChange.Password == tokenBox) { if (textBoxNewPassword.Password == textBoxConfirm.Password) { passChange.Password = textBoxNewPassword.Password; myContext.SaveChanges(); MessageBox.Show("Password berhasil diganti"); LoginWindow login = new LoginWindow(); login.Show(); this.Close(); } else { MessageBox.Show("Please confirm your new password"); textBoxNewPassword.Clear(); textBoxConfirm.Clear(); } } else { MessageBox.Show(tokenBox + passChange.Password); //MessageBox.Show(passChange.Password); MessageBox.Show("Token Wrong!!! Please Check your Email"); } } else { MessageBox.Show("Wrong Username"); } }