Added logic to 2-factor authentication