WL-1803 Apply SIGNUP-114 patch

Someone provided a patch for SIGNUP-114 / WL-1803.  The code didn't apply cleanly but I've merged it
in and made some minor changes to make it run on our setup.

I've not checked the code; there does seem to be a lot of it for what it's actually doing.

It appears to work fine.