Does various useful things on user login.