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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:03:31+00:00 2026-06-17T05:03:31+00:00

Definition of strange: My app’s session model seems to work fine. The cookie (user.remember_token

  • 0

Definition of strange:
My app’s session model seems to work fine. The cookie (user.remember_token = SecureRandom.urlsafe_base64) is stored, the signin persists. Life is good.

Yet, when a user edits their profile and clicks submit, they are logged out.

This SO Question makes me think that Rails is ending the session because of XSRF.

But why?

Instead of posting all my code here, one link gets it all: https://github.com/chiperific/arcwmi_reports

Help!

  • 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-17T05:03:32+00:00Added an answer on June 17, 2026 at 5:03 am

    Your problem is in the User model:

    before_save :create_remember_token
    
    def create_remember_token
      self.remember_token = SecureRandom.urlsafe_base64
    end
    

    This will modify the remember_token whenever the user is saved – that is, when the user is created or updated. And when a user updates his/her profile, the remember_token is changed. This causes the login system to notice that the cookie no longer matches the user – and logs the user out.

    The fix – use before_create instead of before_save.

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

Sidebar

Related Questions

Strange thing... I have a binding definition user-wrapper.xml: <binding> <include path=core-wrapper.xml /> <include path=user-composite-entity.xml
I have a strange problem regarding Flash error 1151: A conflict exists with definition
I'm experiencing a rather strange problem with foreign keys, namely this doesn't work as
can anybody explain the following strange behaviour of update form ? the model post.rb
I have a strange problem. I have an app written in Play! framework 2.0.4.
Have a strange problem in that I have a Rake task that seems to
This seems like a fairly strange bug to me. My C++ program is segfaulting,
I'm facing a strange crash of my app that occurs only with iOS5. The
I am looking for a strange macro definition, on purpose: I need a macro
Definition of SUCCEEDED(): #define SUCCEEDED(hr) (((HRESULT)(hr)) >= 0) Background: When an Ok button is

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.