We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

andy • 9 years ago

The Houdini/two_factor_authentication gem, which you link to, does this out of the box. The demo app has two form steps. They do this by hooking into Warden.after_authenticate and setting a session variable to block future page loads until 2fa is successful

Tommy Ku • 9 years ago

@andy Yeah I looked at their code and it seems so. But I can't find the demo you talked about, is there a link to it?

daniel tea • 9 years ago

the demo app is in a different repo here: https://github.com/Houdini/.... i'm working on a project and am currently in the same situation as figuring out how to implement the two-step aspect of authentication. would Warden.after_authentication achieve the same effect as yours results in this post?

akshat uppal • 6 years ago

Can someone please help me out.
I am getting this error:
ActionView::Template::Error (undefined method `otp_attempt' for #<clientaccount:0x00007efc90d21b38>)

Tommy Ku • 6 years ago

It appears that the parameter otp_attempt isn't attached to your model. Without replicable code sample it is difficult to tell exactly what's wrong but I suspect you haven't extended your model with a `devise :two_factor_authenticatable` and the like.

MartinIAm • 6 years ago

Does this still work in Rails 6? This is one of the only two factor auth tutorials for rails without having to pay a subscription for a third party.

Tommy Ku • 6 years ago

Sorry it has been years since I stopped developing in Rails. By looking at the commit log it appears Rails 6 is supported https://github.com/tinfoil/...

Chiel Hackman • 9 years ago

I've tried a lot of examples for two-factor-authentication in Rails, but this is the only I get actually work!
With this starting point it's easier to adjust it to your own needs, like sending the code through sms.

Thanks!