call on_login before writing