Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8769983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:28:06+00:00 2026-06-13T17:28:06+00:00

I want to add a subscription type functionality in my application for the account

  • 0

I want to add a subscription type functionality in my application for the account holder users such that with few failed login attempts they will not be able to access their account. Note: I don’t want to delete their account from the database. I’ve already installed devise-2.1.2 in my application. Do any body have any idea how can it be done? I am newbie to Ruby on rails so it will be very helpful to me if you please explain the steps.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T17:28:06+00:00Added an answer on June 13, 2026 at 5:28 pm

    Devise have a buil-in solution with the :lockable option check in the Devise Lockable Documentation

    You have to set the lock_strategy set to :failed_attempts.

    Step 1
    Set your config/initializers/devise.rb to use:

    # Defines which strategy will be used to lock an account.
    config.lock_strategy = :failed_attempts
    
    # Defines which key will be used when locking and unlocking an account
    config.unlock_keys = [ :time ]
    
    # Defines which strategy will be used to unlock an account.
    # :time  = Re-enables login after a certain amount of time (see :unlock_in below)
    config.unlock_strategy = :time
    
    # Number of authentication tries before locking an account if lock_strategy
    # is failed attempts.
    config.maximum_attempts = 3
    
    # Time interval to unlock the account if :time is enabled as unlock_strategy.
    config.unlock_in = 2.hours
    

    Step 2
    Your should add the lockable to you Model as this:

    class Example < ActiveRecord::Base
      devise :database_authenticatable, :registerable,
             :recoverable, :rememberable, :trackable, :validatable, 
             :lockable
    

    Step 3
    Generate the migrations to make devise work

    class AddLockableToExamples < ActiveRecord::Migration
      def change
        add_column :examples, :failed_attempts, :integer, default: 0
        add_column :examples, :unlock_token, :string
        add_column :examples, :locked_at, :datetime
      end
    end
    

    Regards!!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a module that let's your users add feeds. So i want my
I want to add a mailchimp subscription form my drupal site to allow users
I want add UIGestureRecognizerDelegate to UIWebView,but failed. if [self.view addsubView:webView]; So UIWebView is ok,but
I have a list of string values that I want add to a hashtable
hi when i write css or html i found that i want add two
I'm writing two web application that simulate the Publisher/Subscriber pattern. A client add a
I want to create a simple subscription based account management on a PHP and
I want to add new field in My Account page, say check box for
i have two submit buttons on my mvc application. 1. <input type=submit class=btnsubmit value=Add
I just want to add the subscription date in the User list in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.