Giter Club home page Giter Club logo

Comments (4)

Bouke avatar Bouke commented on July 21, 2024

Django-two-factor-auth doesn't require LOGIN_URL to be configured to link to two_factor:login, but it is advised to do so. By doing so, the OTP login flow will be used when a user with OTP enabled tries to login. For users with OTP disabled, there is no additional steps to provide OTP tokens.

Without setting LOGIN_URL, the @otp_required decorator (and the like), will still work. You'll be required however to point them to the correct URL for two_factor:login. Does this solve your question?

from django-two-factor-auth.

awais786 avatar awais786 commented on July 21, 2024

In code base at various places this variable is in use settings.LOGIN_URL e.g
class AdminSiteOTPRequiredMixin(object):

def login(self, request, extra_context=None):
"""
Redirects to the site login page for the given HttpRequest.
"""
return redirect('%s?%s' % (
settings.LOGIN_URL,
urlencode({REDIRECT_FIELD_NAME: request.get_full_path()})
))

And as we are using this Login_url for another app so admin OTP decorator redirects towards here. and we just place TWO_FACTOR_PATCH_ADMIN=True in our settings.

from django-two-factor-auth.

Bouke avatar Bouke commented on July 21, 2024

You're correct; the code should not use LOGIN_URL, but should've used two_factor:login. I've changed the code in those places. Please try the code from the master branch and let me know if it works for you.

from django-two-factor-auth.

muzafar-yousaf avatar muzafar-yousaf commented on July 21, 2024

Yeah, it's working as expected now. Thank you for quick fix.

from django-two-factor-auth.

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.