def user_known(env, user):
    """Returns whether the user has ever been authenticated before."""

    for row in env.db_query("""
            SELECT 1
             FROM session
            WHERE authenticated=1 AND sid=%s
            """, (user,)):
        return True

    return False