Search in sources :

Example 1 with ChangePasswordResponse

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);
        }
    });
}
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 ChangePasswordResponse

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);
        }
    });
}
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 3 with ChangePasswordResponse

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;
}
Also used : GetPermissionsResponse(com.willshex.blogwt.shared.api.user.call.GetPermissionsResponse) GetUsersResponse(com.willshex.blogwt.shared.api.user.call.GetUsersResponse) Response(com.google.gwt.http.client.Response) ChangeUserAccessResponse(com.willshex.blogwt.shared.api.user.call.ChangeUserAccessResponse) ResetPasswordResponse(com.willshex.blogwt.shared.api.user.call.ResetPasswordResponse) LogoutResponse(com.willshex.blogwt.shared.api.user.call.LogoutResponse) GetUserDetailsResponse(com.willshex.blogwt.shared.api.user.call.GetUserDetailsResponse) RegisterUserResponse(com.willshex.blogwt.shared.api.user.call.RegisterUserResponse) VerifyAccountResponse(com.willshex.blogwt.shared.api.user.call.VerifyAccountResponse) FollowUsersResponse(com.willshex.blogwt.shared.api.user.call.FollowUsersResponse) GetRolesResponse(com.willshex.blogwt.shared.api.user.call.GetRolesResponse) GetEmailAvatarResponse(com.willshex.blogwt.shared.api.user.call.GetEmailAvatarResponse) GetRolesAndPermissionsResponse(com.willshex.blogwt.shared.api.user.call.GetRolesAndPermissionsResponse) ChangeUserDetailsResponse(com.willshex.blogwt.shared.api.user.call.ChangeUserDetailsResponse) IsAuthorisedResponse(com.willshex.blogwt.shared.api.user.call.IsAuthorisedResponse) ChangePasswordResponse(com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse) CheckUsernameResponse(com.willshex.blogwt.shared.api.user.call.CheckUsernameResponse) LoginResponse(com.willshex.blogwt.shared.api.user.call.LoginResponse) BlockUsersResponse(com.willshex.blogwt.shared.api.user.call.BlockUsersResponse) ForgotPasswordResponse(com.willshex.blogwt.shared.api.user.call.ForgotPasswordResponse) RequestCallback(com.google.gwt.http.client.RequestCallback) ForgotPasswordRequest(com.willshex.blogwt.shared.api.user.call.ForgotPasswordRequest) ChangeUserAccessRequest(com.willshex.blogwt.shared.api.user.call.ChangeUserAccessRequest) GetUserDetailsRequest(com.willshex.blogwt.shared.api.user.call.GetUserDetailsRequest) ChangePasswordRequest(com.willshex.blogwt.shared.api.user.call.ChangePasswordRequest) GetEmailAvatarRequest(com.willshex.blogwt.shared.api.user.call.GetEmailAvatarRequest) IsAuthorisedRequest(com.willshex.blogwt.shared.api.user.call.IsAuthorisedRequest) RegisterUserRequest(com.willshex.blogwt.shared.api.user.call.RegisterUserRequest) GetRolesRequest(com.willshex.blogwt.shared.api.user.call.GetRolesRequest) LogoutRequest(com.willshex.blogwt.shared.api.user.call.LogoutRequest) ChangeUserDetailsRequest(com.willshex.blogwt.shared.api.user.call.ChangeUserDetailsRequest) GetRolesAndPermissionsRequest(com.willshex.blogwt.shared.api.user.call.GetRolesAndPermissionsRequest) VerifyAccountRequest(com.willshex.blogwt.shared.api.user.call.VerifyAccountRequest) ResetPasswordRequest(com.willshex.blogwt.shared.api.user.call.ResetPasswordRequest) GetUsersRequest(com.willshex.blogwt.shared.api.user.call.GetUsersRequest) FollowUsersRequest(com.willshex.blogwt.shared.api.user.call.FollowUsersRequest) BlockUsersRequest(com.willshex.blogwt.shared.api.user.call.BlockUsersRequest) CheckUsernameRequest(com.willshex.blogwt.shared.api.user.call.CheckUsernameRequest) LoginRequest(com.willshex.blogwt.shared.api.user.call.LoginRequest) GetPermissionsRequest(com.willshex.blogwt.shared.api.user.call.GetPermissionsRequest) Request(com.google.gwt.http.client.Request) JSONException(com.google.gwt.json.client.JSONException) HttpException(com.willshex.gson.web.service.client.HttpException) ChangePasswordResponse(com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse) RequestException(com.google.gwt.http.client.RequestException)

Aggregations

ChangePasswordRequest (com.willshex.blogwt.shared.api.user.call.ChangePasswordRequest)3 ChangePasswordResponse (com.willshex.blogwt.shared.api.user.call.ChangePasswordResponse)3 ChangePasswordFailure (com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordFailure)2 ChangePasswordSuccess (com.willshex.blogwt.client.api.user.event.ChangePasswordEventHandler.ChangePasswordSuccess)2 Request (com.google.gwt.http.client.Request)1 RequestCallback (com.google.gwt.http.client.RequestCallback)1 RequestException (com.google.gwt.http.client.RequestException)1 Response (com.google.gwt.http.client.Response)1 JSONException (com.google.gwt.json.client.JSONException)1 BlockUsersRequest (com.willshex.blogwt.shared.api.user.call.BlockUsersRequest)1 BlockUsersResponse (com.willshex.blogwt.shared.api.user.call.BlockUsersResponse)1 ChangeUserAccessRequest (com.willshex.blogwt.shared.api.user.call.ChangeUserAccessRequest)1 ChangeUserAccessResponse (com.willshex.blogwt.shared.api.user.call.ChangeUserAccessResponse)1 ChangeUserDetailsRequest (com.willshex.blogwt.shared.api.user.call.ChangeUserDetailsRequest)1 ChangeUserDetailsResponse (com.willshex.blogwt.shared.api.user.call.ChangeUserDetailsResponse)1 CheckUsernameRequest (com.willshex.blogwt.shared.api.user.call.CheckUsernameRequest)1 CheckUsernameResponse (com.willshex.blogwt.shared.api.user.call.CheckUsernameResponse)1 FollowUsersRequest (com.willshex.blogwt.shared.api.user.call.FollowUsersRequest)1 FollowUsersResponse (com.willshex.blogwt.shared.api.user.call.FollowUsersResponse)1 ForgotPasswordRequest (com.willshex.blogwt.shared.api.user.call.ForgotPasswordRequest)1