Devise::lockable manual locking?

506 views
Skip to first unread message

Amit Mutreja

unread,
Apr 22, 2015, 1:14:59 PM4/22/15
to plataforma...@googlegroups.com
Hi

I want to do lock a user account by default whenever admin creates it in the system and unlocking will be done by the admin later. How can I achieve this?

I configured in the file devise.eb:
config.lock_strategy = :none
config.unlock_strategy = :none

but I am not sure what to do in user.rb (devise :lockable is added in user.rb)
I can add a field in "locked_at" as two functions lock_access! and "unlock_access!" are using this field but how to use these two functions present in Devise::lockable.rb?
Can i get some example for manual locking and unlocking, that is, no lock strategy?

Thanks & Regards
Amit

Lucas Mazza

unread,
Apr 23, 2015, 1:28:18 PM4/23/15
to plataforma...@googlegroups.com
Since your model already includes the Lockable module, even when disabling the "automatic" locking with 'lock_strategy = :none' you can still call 'lock_access!' or 'unlock_access!' with your models - so you don't have to implement that on your own.

--

---
You received this message because you are subscribed to the Google Groups "Devise" group.
To unsubscribe from this group and stop receiving emails from it, send an email to plataformatec-de...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages