Giter Site home page Giter Site logo

Comments (2)

adamcooke avatar adamcooke commented on September 23, 2024

The before_validation will always be run before the before_create so I'm puzzled why you're seeing any errors here. Do you have some examples of the exact error you're receiving?

Thanks!

from authie.

admpsktt avatar admpsktt commented on September 23, 2024

Hi @adamcooke. Thanks for getting back. I was able to reproduce the error mentioned in the title of the issue by faking a user-agent of 256 characters or more in Chrome developer tools and logging in to my app through an Authie::Session.

before_validation is indeed run before before_create but in before_create, when in a controller context, self.user_agent= is invoked again, overriding what happens in the before_validation callback.

If you are able to reproduce the problem, I suspect it can be resolved by changing the line in the before_create from:

self.user_agent = controller.request.user_agent

to:

self.user_agent = controller.request.user_agent[0,255] if controller.request.user_agent.is_a? String

Am I missing something?

from authie.

Related Issues (13)

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.