fixes #4895 - Adds CSRF protection check to the API if a session user is present
templates - sync from community-templates
Fixes #4710, #2270 - Wait for VM to become ready before looking for IPs