Search in sources :

Example 1 with ChangePasswordSuccess

use of com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordSuccess 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);
        }
    });
}
Also used : ChangePasswordFailure(com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordFailure) ChangePasswordSuccess(com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordSuccess) ChangePasswordResponse(com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse) ChangePasswordRequest(com.willshex.blogwt.shared.api.user.call.ChangePasswordRequest)

Example 2 with ChangePasswordSuccess

use of com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordSuccess 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);
        }
    });
}
Also used : ChangePasswordFailure(com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordFailure) ChangePasswordSuccess(com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordSuccess) ChangePasswordResponse(com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse) ChangePasswordRequest(com.willshex.blogwt.shared.api.user.call.ChangePasswordRequest)

Aggregations

ChangePasswordFailure (com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordFailure)2 ChangePasswordSuccess (com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordSuccess)2 ChangePasswordRequest (com.willshex.blogwt.shared.api.user.call.ChangePasswordRequest)2 ChangePasswordResponse (com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse)2