Refactored user auth check and user loading up to the app level since site_layout needs it.