GithubHelp home page GithubHelp logo

Comments (6)

tiegz avatar tiegz commented on September 27, 2024 4

@sthyregod you'd put this in your session model. Could do something like this:

class UserSession < Authlogic::Session::Base
  secure !!Rails.application.config.force_ssl
end

(NB I think force_ssl will be removed in Rails 6.1)

from authlogic.

jaredbeck avatar jaredbeck commented on September 27, 2024 1

.. having it mentioned in the Readme might help ..

PRs welcome

from authlogic.

tiegz avatar tiegz commented on September 27, 2024

Firefox on local network does not create credentials cookie when 'remember_me' is ticked. Login is thus not remembered cross-session.

Assuming your development is non-HTTPS, have you tried disabling SSL-only remember-me cookies for development? e.g. UserSession.secure = false

# Should the cookie be set as secure? If true, the cookie will only be sent over
# SSL connections
#
# * <tt>Default:</tt> true
# * <tt>Accepts:</tt> Boolean
def secure(value = nil)
rw_config(:secure, value, true)
end
alias secure= secure

from authlogic.

sthyregod avatar sthyregod commented on September 27, 2024

The behaviour is the same as before as far as I can see. I believe the line should be inserted into the app/config/environments/development.rb file? I'm new to Rails from C# MVC, so I'm not completely accustomed to the structure yet.

I came to think, I expect having two separate Session models wouldn't interfere with eachother, e.g. creating the mentioned problem. For example having a CustomerSession for a Customer model and a UserSession for a User model.

from authlogic.

sthyregod avatar sthyregod commented on September 27, 2024

That does it! Credentials cookie is set as expected and when destroying the session the cookie is successfully deleted.

Question is, should anything be done to help others who might become stuck with the same problem? Maybe it's a niche problem, but having it mentioned in the Readme might help (along with what's necessary in 6.1 - of what I saw when looking it up they'd only remove force_ssl on the controller level though. It should still work on the application level).

from authlogic.

bborn avatar bborn commented on September 27, 2024

👏 for @tiegz's solution above. Had the same issue when debugging locally and not running a dev server with ssl. Consider adding a note to the README.

from authlogic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.