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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:44:31+00:00 2026-06-08T22:44:31+00:00

My remember feature if simply login will still create a permanent cookie. I followed

  • 0

My remember feature if simply login will still create a permanent cookie. I followed the following tutorial :http://railscasts.com/episodes/274-remember-me-reset-password

Here what I have

Session Controller

class SessionsController < ApplicationController
  def new
    if current_customer
        redirect_to current_customer
    end
  end
  def create
    customer = Customer.find_by_email(params[:email])
        if customer && customer.authenticate(params[:password])
        if params[:remember_me]
        cookies.permanent[:auth_token] = customer.auth_token
        else
        cookies[:auth_token] = customer.auth_token
        end
            redirect_to customer, :notice => "Logged in!"
        else
            flash.now.alert = "Invalid email or password"
            render "new"
        end
  end

  def destroy
    cookies.delete(:auth_token)
    redirect_to root_url, :notice => "Logged out!"
  end
end

Application Controller

class ApplicationController < ActionController::Base
  protect_from_forgery

  force_ssl

  private

    def authorize
        redirect_to login_url, alert: "Not authorized" if current_customer.nil?
    end

    def current_customer
      @current_customer ||= Customer.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]
    end
    helper_method :current_customer
end

I was thinking of adding a delete if params wasn’t check off to assure myself no other cookie existed. But that doesn’t seem to 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-08T22:44:33+00:00Added an answer on June 8, 2026 at 10:44 pm

    Maybe you should call the helper_method call at the top of your class.

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

Sidebar

Related Questions

I have an autocomplete implementation that is based mostly on this tutorial: http://viralpatel.net/blogs/tutorial-create-autocomplete-feature-with-java-jsp-jquery However
I just implemented a remember me feature for a user login on a website.
I have an ASP.Net website which has a remember me feature for Login page.
Short Working on login system and trying to implement remember me feature. Recently, l
I have a login page, and I want to add the Remember me feature;
I'm trying to implement a remember me feature, following the guidelines provided here: The
What's the best practice to implement sign in Remember Me feature in Java? Obviously,
I remember that I've heard about a flash cs5 feature which lets the developers
I'm trying to add a remember me feature to my web app to let
Has anybody been able to implement a remember me feature with CodeIgniter's FreakAuth Library?

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.