rept
rept

Reputation: 2236

Manually lock an account in Devise

I have set up 2-factor authentication and I also have lockable activated in devise (with 10 minute timeout).

The lockable works fine, but I want it to work for the 2fa code too.

2 questions with this:

Upvotes: 2

Views: 2302

Answers (1)

rylanb
rylanb

Reputation: 614

Part 1: You could look at adding a new column to the user model to track the # of 2FA attempts and tick that up. But you run into a LOT of what-ifs almost immediately. What if they stop, come back, re-authenticate properly? Make sure to reset that count so it doesn't fail them faster next time, for one example.

Part 2: Manually locking is done with lock_access! call on the user instance variable.

Upvotes: 4

Related Questions