Implement login functionality. Closes #3