ruby on rails - How to lock users using Devise? -
I want to add functionality of a subscription type to account holder users in my application such as after the fixed interval of time Not able to access the account? Note: I do not want to delete my account from the database. I have already installed There is a buil-in solution in Delios Step 1 : Step 2 You should add lockable to your model as: Step 3 Generate migration to create a job Create a Regards !! devise-2.1.2 in my application. Any body has any idea how it can be done? I am a newbie on the
Railbase so please be very helpful to me if you please explain the steps. You
: lockable option check in
: set to fail_attempts. Set your config / initializers / devise.rb to use
# defines that Which strategy will be used to lock an account? Config.lock_strategy =: fail_attempts # Defines which key is used when locking and unlocking when configuring an account. Unlock_keys = [: time] # Which strategy will be used to unlock an account #: Time = Enables login again after a certain amount (see: unlock below) config.unlock_strategy =: Time # tries the number of authentication before locking an account if the lock_strategy # is in the failed attempts config.maximum_attempts = 3 # time interval to unlock the account if: Unlock_Startage is enabled as time is Config.unlock_i Step 2
class example & LT; ActiveRecord :: Prepare for Base: Database_Author,: Registerable, Recoverable, Memorable, Trackable, Valid: Eligible, Lockable
class AddLockableToExamples & lt; ActiveRecord :: migrate def changed add_column: example, failed: failure, integer, default: 0 add_column: example,: unlock_token: string add_column: example,: locked_at,: datetime end end
Comments
Post a Comment