[#1419] Move URL locality checking to helpers

This allows the function to be also used for similar purposes outside
the user controller.

Also rename the function to be more descriptive in this general
setting.
[#1419] Check that redirection target is local
[#1419] Abort with 403 when attempting external redirect
[#1419] Better status for when no param supplied. Added test.