Logout user and emit event.

def logout(self):
        """ Logout user and emit event."""
        from flask_login import logout_user, current_user
        if not current_user.is_authenticated:
            return True

        # logout otherwise
        user = current_user
        events.logout_event.send(user)
        logout_user()

        # notify principal
        app = current_app._get_current_object()
        identity_changed.send(app, identity=AnonymousIdentity())

        return True