Add retrieve_password_message function and associated hooks