Auth: username, userId returned with token

Send the logged in user's username and userId back with the token on log
in and registration. This is saved to the user's browser for quick
reference in other parts of the code later.

Also general clean up on both client side and server side auth code.