def out_filter(user):
    """
    输出给用户是，出于安全考虑，以及格式要求，进行过滤操作
    :param user: 用户对象
    :return: user 过滤后的用户对象
    """
    if user is None:
        return user
    if user.get('pwd_hash') is None:
        user['has_pwd'] = 0
    else:
        user['has_pwd'] = 1
        user.pop('pwd_hash')
        user.pop('salt')
    return user
