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 9163421
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:26:37+00:00 2026-06-17T14:26:37+00:00

How would one redirect a non confirmed user on login to a certain page

  • 0

How would one redirect a non confirmed user on login to a certain page instead of showing a :notice ( " you have to confirm your account " ). Using the Devise gem (latest)

This question: ( Devise – Redirected to page if account isn't confirmed ) provides this solution:

# config/initializers/my_strategy.rb
Warden::Strategies.add(:my_strategy) do 
  def valid? 
    true
  end 

  def authenticate! 
    u = User.find_for_authentication(:email => params[:email])
    if u.nil? || !u.valid_password?(params[:password])
      fail(:invalid)
    elsif !u.confirmed?
      fail!("Account needs confirmation.")
      redirect!("your_root_url")
    end
  else
    success!(u)
  end    
end

#config/initializers/devise.rb
config.warden do |manager|  
  manager.default_strategies(:scope => :user).unshift :my_strategy
end

which does not work.

  • 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-17T14:26:38+00:00Added an answer on June 17, 2026 at 2:26 pm

    I fixed it like in example below
    BUT I would like to know if its possible to pass the User object ( username ) inside this method so I can redirect to /confirm/ using devise user model user.username or user.login..

      config.warden do |manager|
        manager.failure_app = CustomFailure
      end
    
      class CustomFailure < Devise::FailureApp
        def redirect_url
            if warden_message == :unconfirmed
              "/confirm"
            else
              super
            end
          end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to redirect multiple entries to my landing page to one url.
We've been trying to redirect from one action to another, hoping that data would
I'm trying to redirect users of a web page to one of two different
I would like to redirect all non-files, non-directories to index.php, so everything that exists
Here's my problem: I have many differents pages in one big HTML page and
Lets say I have a site that has one page that handles all requests
How would one shorten the following using ternary operators? if ((pos - maxPos) ==
How would one insert an array full of smtp email addresses into an AD
How would one enumerate the installed browsers on an OS X system from a
How would one switch a public bool to true from a child form in

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.