add support for two-factor authentication

todo: add test case

fixes #1