Check before calling logged_in.
Add portal messages later, because they get clobbered by other template
renders.