Tweak lastlogin logic

Move Test mode logic, use string formatting