This is an example project that demonstrates how to implement OTP two-factor authentication in devise so that the user for their OTP code as a second login step.
andresantonioriveros/devise-otp-second-step
An example of how to implemented OTP two-factor authentication as a second login step in Rails and Devise
Ruby