Logout hook

Adds logout hook functionality to the flask and php apps