Implement login.

Resolves #1