Moving login to the adapter (closes #519)