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

  • Home
  • SEARCH
  • 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 3986270
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:59:29+00:00 2026-05-20T05:59:29+00:00

I use Devise for authentication and I have an admin role who can manage

  • 0

I use Devise for authentication and I have an admin role who can manage users.

Apart from this the admin can also lock a user preventing him from logging in the future. I have created a Boolean field inside ‘User’ model called ‘is_locked?’. When the admin locks a user this boolean field is set to true. Based on this info I can know if a user is locked or not.

Now when user tries to log in, before setting up his session, I have to check this logic. I’m clueless about where to add this logic. Or this any custom methods or events which devise provides, so that I can add it there.

  • 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-05-20T05:59:30+00:00Added an answer on May 20, 2026 at 5:59 am

    I’ve found that you can stack before_filters in the controller, so if you wanted to check for an authenticate_user!, you could also use a before_filter (after authenticate_user!) to check for a locked user. If the user model has a boolean attribute locked, you can simply write a private method in your controller (or helper) like this:

    #top of controller
    before_filter authenticate_user!
    before_filter user_active!
    
    #bottom of controller
    private
    def user_active!
      unless current_user.locked?
        return true
      end
      redirect_to root_url, :notice => "Your account is locked."
      return false
    end
    

    This will give you the page you want if you’re an unlocked user, and redirect you to the root page with an error message if the user is locked.

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

Sidebar

Related Questions

I currently use Devise for user registration/authentication in a Rails project. When a user
The Devise authentication framework uses flash notices everywhere. This makes it easy to integrate
I have a problem using devise with an AJAX login. I'm using the :remote
I rails3.0.4 and devise installed with following users table create_table users, :force => true
I'm wondering how I can authenticate a user through their device, so they don't
We are development an announcement mechanism that works in such way: - Users are
I would like to provide a (auto discoverable) link to a private RSS feed
What I am looking to do is create a simple Java audio streaming server.
What I'm referring to is a documented bug: http://www.google.com/support/forum/p/apps-apis/thread?tid=58c4f7fbe60be52c&hl=en . Basically, when I use
I am working on an iPhone App which communicates with a Server to store

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.