Implement two-factor authentication support

Closes #432