@POST
    @UnitOfWork
    @Path("password")
    @Timed
    public Response changePassword(@Context HttpServletRequest request, @RobeAuth Credentials credentials, Map<String, String> passwords) {
    """
	User Change Password
	<p>
	Status Code:
	NOT_FOUND not found user.
	PRECONDITION_FAILED change passsword error.
	
	@param request     HttpServletRequest
	@param passwords   password(SHA256),newpassword(SHA256) and newpasswordrpt(SHA256)
	@param credentials injected by {@link RobeAuth} annotation for authentication.
	@return {@link Response}
	@throws Exception for not found user
    """

        Optional<User> user = userDao.findByUsername(credentials.getUsername());
        if (!user.isPresent()) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        } else if (user.get().getPassword().equals(passwords.get("password"))) {
            if (passwords.get("newPassword").equals(passwords.get("newPasswordRepeat"))) {
                user.get().setPassword(passwords.get("newPassword"));
                return Response.status(Response.Status.OK).entity("Your password has been updated").build();
            } else {
                return Response.status(Response.Status.PRECONDITION_FAILED).entity("Your new password does not match.").build();
            }

        } else {
            return Response.status(Response.Status.PRECONDITION_FAILED).entity("Your password is incorrect.").build();
        }

    }
@POST
    @UnitOfWork
    @Path("password")
    @Timed
    public Response changePassword(@Context HttpServletRequest request, @RobeAuth Credentials credentials, Map<String, String> passwords) {

        Optional<User> user = userDao.findByUsername(credentials.getUsername());
        if (!user.isPresent()) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        } else if (user.get().getPassword().equals(passwords.get("password"))) {
            if (passwords.get("newPassword").equals(passwords.get("newPasswordRepeat"))) {
                user.get().setPassword(passwords.get("newPassword"));
                return Response.status(Response.Status.OK).entity("Your password has been updated").build();
            } else {
                return Response.status(Response.Status.PRECONDITION_FAILED).entity("Your new password does not match.").build();
            }

        } else {
            return Response.status(Response.Status.PRECONDITION_FAILED).entity("Your password is incorrect.").build();
        }

    }
@ POST @ UnitOfWork @ Path ( "password" ) @ Timed public Response changePassword ( @ Context HttpServletRequest request , @ RobeAuth Credentials credentials , Map < String , String > passwords ) { Optional < User > user = userDao . findByUsername ( credentials . getUsername ( ) ) ; if ( ! user . isPresent ( ) ) { throw new WebApplicationException ( Response . Status . NOT_FOUND ) ; } else if ( user . get ( ) . getPassword ( ) . equals ( passwords . get ( "password" ) ) ) { if ( passwords . get ( "newPassword" ) . equals ( passwords . get ( "newPasswordRepeat" ) ) ) { user . get ( ) . setPassword ( passwords . get ( "newPassword" ) ) ; return Response . status ( Response . Status . OK ) . entity ( "Your password has been updated" ) . build ( ) ; } else { return Response . status ( Response . Status . PRECONDITION_FAILED ) . entity ( "Your new password does not match." ) . build ( ) ; } } else { return Response . status ( Response . Status . PRECONDITION_FAILED ) . entity ( "Your password is incorrect." ) . build ( ) ; } }
User Change Password
<p>
Status Code:
NOT_FOUND not found user.
PRECONDITION_FAILED change passsword error.

@param request     HttpServletRequest
@param passwords   password(SHA256),newpassword(SHA256) and newpasswordrpt(SHA256)
@param credentials injected by {@link RobeAuth} annotation for authentication.
@return {@link Response}
@throws Exception for not found user
User Change Password <p > Status Code : NOT_FOUND not found user . PRECONDITION_FAILED change passsword error .