Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Devise lockable - How to unlock account using unlock_in

Let me post what I have done first:

config.lock_strategy = :failed_attempt
config.unlock_keys = [ :email ]
config.unlock_strategy = :both
config.maximum_attempts = 10
config.unlock_in = 30.minutes

I have added all the fields in the respective table and added: lockable in model as well.

The problem I am facing is, my account is getting locked upon 10 bad attempts, and Admin is able to log in and manually unlock it.

However my 2nd scenario is, I need the account to be unlocked after 30min as I have specified.

I need to know if I am supposed to be calling any separate method for unlock_in to work.

like image 555
Kedarnag Mukanahallipatna Avatar asked Oct 20 '14 12:10

Kedarnag Mukanahallipatna


1 Answers

I don´t know if this is still relevant, but the code below solve for me:

user.unlock_access!
like image 52
Thiago Avatar answered Sep 19 '22 01:09

Thiago