Code Monkey home page Code Monkey logo

Comments (4)

akx avatar akx commented on July 20, 2024

Without digging in deeper, one simple solution/workaround that comes to mind would be to serve /sw.js from a middleware before the 2FA middleware.

from django-allauth-2fa.

simonkern avatar simonkern commented on July 20, 2024

Login also breaks if you happen to do any sort of request in between login and two-factor-authentication, e.g., pulling latest news for a sidebar widget via ajax etc. Therefore, I don't think the above mentioned approach solves this issue for good. I propose the solution in the pull request, which tries to remove allauth_2fa_user_idin two places:

  1. After a successful login and two-factor-authentication of a user that has 2FA enabled. After the initial login (with username and passwort only), an already presentallauth_2fa_user_id will be overwritten anyway. So we only need to take care of it after authentication.
  2. After a successful login of a user that does not have 2FA enabled. We could also clear it before the login - however, this is out of this app's scope.

The only time an artifact of allauth_2fa_user_id can remain in the session is between an abortion of the 2fa-flow and the user's next successful login (which will clear or overwrite it).

Please note: I just commented out the old tests. Before merging, the code should be cleaned up properly. Just let me know, if this approach is fine for you and I'll clean it up properly and update the docs.

from django-allauth-2fa.

sabipu avatar sabipu commented on July 20, 2024

@simonkern I don't think the codebase maintainers are all that active about this project.

I did ran into the same problem a while ago and this is what I did to work around it.
#93 (comment)

from django-allauth-2fa.

simonkern avatar simonkern commented on July 20, 2024

Any chance of getting this or what @sabipu mentioned merged?

from django-allauth-2fa.

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.