Fixes #826: cleaned up User::getReturnUrl().