Make sure the "next" URL is in the same origin as Horizon before
redirecting to it.
Conflicts:
horizon/test/unit/workflows/test_workflows.py
Adapted to work with Django before 1.11 which only has a host argument,
instead of allowed_hosts for django.utils.http.is_safe_url().
Change-Id: I06b2bfc8e3638591615547780c3fa34b0abe19f6
Closes-bug: #1865026
(cherry picked from commit 252467100f)
(cherry picked from commit baa370f843)
(cherry picked from commit 6c208edf32)
(cherry picked from commit 8825407c1b)