use of system.DeleteUserCredentials in project Money-Manager by krHasan.
the class RegistrationIssueController method btnDelete.
@FXML
private void btnDelete(ActionEvent event) {
if (!txtUsername.getText().equals(getUsername())) {
lblMsgInformation.setText("Information did't match");
txtUsername.clear();
passPassword.clear();
loadSQuestion();
txtAnswer.clear();
} else if (!passPassword.getText().equals(getPassword())) {
lblMsgInformation.setText("Information did't match");
txtUsername.clear();
passPassword.clear();
loadSQuestion();
txtAnswer.clear();
} else if (!securityQuestionAnswerIsOk(txtAnswer.getText())) {
lblMsgInformation.setText("Information did't match");
txtUsername.clear();
passPassword.clear();
loadSQuestion();
txtAnswer.clear();
} else if (!cmboSecurityQuestion.getValue().equals(getSavedSecurityQuestion())) {
lblMsgInformation.setText("Information did't match");
txtUsername.clear();
passPassword.clear();
loadSQuestion();
txtAnswer.clear();
} else {
new DeleteUserCredentials().initializeApplication();
Stage RegistrationIssueStage = (Stage) btnDelete.getScene().getWindow();
(new GoToOperation()).goToSignIn(RegistrationIssueStage);
Alert confirmationMsg = new Alert(AlertType.INFORMATION);
confirmationMsg.setTitle("Operation Successful");
confirmationMsg.setHeaderText(null);
confirmationMsg.setContentText("User Information Deleted Successfully");
confirmationMsg.setX(RegistrationIssueStage.getX() + 200);
confirmationMsg.setY(RegistrationIssueStage.getY() + 170);
Timeline idlestage = new Timeline(new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
confirmationMsg.hide();
}
}));
idlestage.setCycleCount(1);
idlestage.play();
confirmationMsg.showAndWait();
}
}
Aggregations