Renew session when starting with saved credentials

We save OAuth credentials in local storage; if we use them for login,
we need to renew the session so that resources that depend on session
auth (such as uploaded images) still work.

There's a new endpoint /main/renew that uses OAuth auth and will set
the session principal and return that user. And the document ready
function now calls it if there are stored authentication credentials.