@route('/user', method='PATCH', apply=AuthenticatedPlugin(), skip=UserVerifiedPlugin)
def update_authenticated_user():
    """Update one or multiple fields of the authenticated user."""
    # Load update request data
    try:
        user_info, errors = UserSchema(strict=True).load(request.json, partial=True)
    except ValidationError as err:
        message = ' '.join([e['detail'] for e in err.messages['errors']])
        abort(httplib.BAD_REQUEST, message)

    # Patch in user_id manually (do not allow requests to change id)
    user_info['user_id'] = request.user.user_id

    # Ensure that user name is not taken
    if (user_info.get('user_name', request.user.user_name) != request.user.user_name and
        local.model.user_exists(user_info['user_name'], None)):
        abort(httplib.BAD_REQUEST, "User name %s is already taken." % user_info['user_name'])

    # Validate user name
    if not NAME_REGEX.match(user_info.get('user_name', request.user.user_name)):
        abort(httplib.BAD_REQUEST, "User name characters must be alphanumeric, underscores, periods, or dashes.")

    # Update user
    local.model.update_user_info(user_info)

    # Return updated user
    return UserSchema().dump(local.model.get_user(request.user.user_id)).data
dataset/ETHPy150Open codalab/codalab-cli/codalab/rest/users.py/update_authenticated_user/original