use of edu.stanford.bmir.protege.web.client.auth.AuthenticatedActionExecutor in project webprotege by protegeproject.
the class ChangePasswordPresenter method executeChangePassword.
private void executeChangePassword(final ChangePasswordData data, final WebProtegeDialogCloser closer) {
AuthenticatedActionExecutor executor = new AuthenticatedActionExecutor(dispatchServiceManager, new PasswordDigestAlgorithm(new Md5DigestAlgorithmProvider()), new ChapResponseDigestAlgorithm(new Md5DigestAlgorithmProvider()));
String currentPassword = data.getOldPassword();
String newPassword = data.getNewPassword();
ChangePasswordActionFactory actionFactory = new ChangePasswordActionFactory(newPassword, new SaltProvider());
executor.execute(userId, currentPassword, actionFactory, new AuthenticatedDispatchServiceCallback<ChangePasswordResult>() {
@Override
public void handleAuthenticationResponse(@Nonnull AuthenticationResponse response) {
if (response == AuthenticationResponse.SUCCESS) {
MessageBox.showMessage("Your password has been changed");
closer.hide();
} else {
handleIncorrectCurrentPassword();
}
}
@Override
public String getProgressDisplayTitle() {
return "Changing password";
}
@Override
public String getProgressDisplayMessage() {
return "Please wait.";
}
});
}
Aggregations