use of com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse in project blogwt by billy1380.
the class UserController method changeUserPassword.
/**
* @param actionCode
* @param newPassword
*/
public void changeUserPassword(String actionCode, String newPassword) {
final ChangePasswordRequest input = ApiHelper.setAccessCode(new ChangePasswordRequest());
input.session = SessionController.get().sessionForApiCall();
input.resetCode = actionCode;
input.changedPassword = newPassword;
// change password should take a user parameter
ApiHelper.createUserClient().changePassword(input, new AsyncCallback<ChangePasswordResponse>() {
@Override
public void onSuccess(ChangePasswordResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
}
DefaultEventBus.get().fireEventFromSource(new ChangePasswordSuccess(input, output), UserController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new ChangePasswordFailure(input, caught), UserController.this);
}
});
}
use of com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse in project blogwt by billy1380.
the class UserController method changeUserPassword.
public void changeUserPassword(Long userId, String password, String newPassword) {
final ChangePasswordRequest input = ApiHelper.setAccessCode(new ChangePasswordRequest());
input.session = SessionController.get().sessionForApiCall();
input.password = password;
input.changedPassword = newPassword;
// change password should take a user parameter
ApiHelper.createUserClient().changePassword(input, new AsyncCallback<ChangePasswordResponse>() {
@Override
public void onSuccess(ChangePasswordResponse output) {
if (output.status == StatusType.StatusTypeSuccess) {
}
DefaultEventBus.get().fireEventFromSource(new ChangePasswordSuccess(input, output), UserController.this);
}
@Override
public void onFailure(Throwable caught) {
DefaultEventBus.get().fireEventFromSource(new ChangePasswordFailure(input, caught), UserController.this);
}
});
}
use of com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse in project blogwt by billy1380.
the class UserService method changePassword.
public Request changePassword(ChangePasswordRequest input, AsyncSuccess<ChangePasswordRequest, ChangePasswordResponse> onSuccess, AsyncFailure<ChangePasswordRequest> onFailure) {
Request handle = null;
try {
handle = sendRequest(UserMethodChangePassword, input, new RequestCallback() {
@Override
public void onResponseReceived(Request request, Response response) {
try {
ChangePasswordResponse outputParameter = new ChangePasswordResponse();
parseResponse(response, outputParameter);
if (onSuccess != null) {
onSuccess.call(input, outputParameter);
}
onCallSuccess(UserService.this, UserMethodChangePassword, input, outputParameter);
} catch (JSONException | HttpException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangePassword, input, exception);
}
}
@Override
public void onError(Request request, Throwable exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangePassword, input, exception);
}
});
onCallStart(UserService.this, UserMethodChangePassword, input, handle);
} catch (RequestException exception) {
if (onFailure != null) {
onFailure.call(input, exception);
}
onCallFailure(UserService.this, UserMethodChangePassword, input, exception);
}
return handle;
}
Aggregations