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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T20:16:28+00:00 2026-05-15T20:16:28+00:00

I am using authlogic with rails application for authentication. The perishable token is reset

  • 0

I am using authlogic with rails application for authentication.
The perishable token is reset after the user resets his password.
Consider this case.
A user signs up, he forgets to activate the account and he also forgets the passwords.
So he resets the password. Due to this his activation link no longer remains valid. So he cannot activate his account. When he tries to login he get an error that the account is not activated.
The user is stuck!.

What solution I found was to resend the activation link every time the login is prevented due the problem that the account is not activated.

Now the problem is that I need to check what type of error it is when the user tries to login, so that I can resend the activation email.

Regards,
Pankaj

  • 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-15T20:16:28+00:00Added an answer on May 15, 2026 at 8:16 pm

    Rather than check for the actual error, I was able to check for the conditions that cause it using @user_session.attempted_record && !@user_session.invalid_password? &&
    !@user_session.attempted_record.active?

    Here’s my full solution to resending activation emails (after setting up activation using matthook’s tutorial):

    # /app/controllers/users_sessions_controler.rb
    def create
      @user_session = UserSession.new(params[:user_session])
      if @user_session.save
        redirect_back_or_default root_path
      elsif @user_session.attempted_record &&
        !@user_session.invalid_password? &&
        !@user_session.attempted_record.active?
        flash[:notice] = render_to_string(:partial => 'user_sessions/not_active.erb', :locals => { :user => @user_session.attempted_record })
        redirect_to :action => :new
      else
        render :action => :new
      end
    end
    
    # /app/views/user_sessions/_not_active.erb
    Sorry, before you can sign in you need to confirm your email address. <%= link_to('Resend confirmation email', resend_activation_users_path(:login => user.login)) %>
    
    # /app/controllers/users_controller.rb
    def resend_activation
      if params[:login]
        @user = User.find_by_login params[:login]
        if @user && !@user.active?
          @user.deliver_activation_instructions!
          flash[:notice] = "Please check your e-mail for your account activation instructions!"
          redirect_to root_path
        end
      end
    end
    
    # /config/routes.rb
    map.resources :users, :collection => { :resend_activation => :get }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the Authlogic gem as the authentication system for a rails app. This
I'm adding a password reset feature to my Rails application that uses Authlogic. I
I'm using Authlogic with my Ruby on Rails App. I would like user to
Using Authlogic, the time format for @user.last_login_at looks like this: Mon Apr 12 16:52:56
I am using Authlogic for my user authentication, and would like yo add roles
Im trying to test my successfully creates a new user after login (using authlogic).
I am quite new to rails and I am using authlogic for my authentication
I am using authlogic and omniauth for authentication in my Rails 3.0.10 app. However
I'm using Authlogic to perform authentication for my Rails app. My users log in
My team is currently using Authlogic for user authentication, which disables a user's account

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.