add auth functionality + horrible sql querying in view for cross-platform logout