redirect to a certain page instead of :notice when non-confirmed user logs in

generate your own session controller to override devise's default session controller with rails g controller sessions (the name of this controller does not matter, you can have your own choice)

edit config/routes.rb

devise_for :users, :controllers => {:sessions => "sessions"}

edit app/controllers/sessions_controller.rb

class SessionsController < Devise::SessionsController
  def create
    @user = User.find_by_email(params[:user][:email])
    if !@user or @user.confirmed?
      super
    else
      redirect_to YOUR_DESIRED_path
    end
  end 
end

I've had better luck overriding Devise's Controllers in my application for fine tuning, which is usually the Devise SessionsController.

As an example:

class SessionsController < Devise::SessionsController

  def create
    #overriding Devise's create controller first
    super

    #check if current user is inactive
    @user = user_from_current_user
    unless @user.active?
      redirect("your_root_url")
    end
  end

end

HTH


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