Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass 2FA Token in local development #82

Merged
merged 9 commits into from
Jun 1, 2024
Merged

Conversation

anchit-chandran
Copy link
Contributor

@anchit-chandran anchit-chandran commented Jun 1, 2024

Got working with help of @eatyourpeas thanks!

Overview

When in local development (settings.DEBUG=True), bypass the 2FA token step on login.

This improves the developer experience.

Code changes

  • Update various URLs in both project and npda app to only use 2FA / custom auth urls
  • Adds LoginAndOTPRequired and login_and_otp_required mixin&decorator
  • Specifically overrides the .post() method of the RCPCHLoginView class to skip past the normal auth workflow if in debug mode

Documentation changes (done or required as a result of this PR)

  • nil

Related Issues

Mentions

@anchit-chandran anchit-chandran marked this pull request as ready for review June 1, 2024 15:43
@eatyourpeas eatyourpeas self-assigned this Jun 1, 2024
Copy link
Member

@eatyourpeas eatyourpeas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Anchit for this nice piece of work. Looks all good.
One thing I have changed - would like to know whether you agree - is that I have removed the requirement to be both DEBUG and superuser to skip 2FA. My rationale is that 2FA is for production only, when DEBUG will be False, and I have found otherwise that if we are testing with different user accounts, it throws a 403.

@eatyourpeas eatyourpeas merged commit 1ec4af8 into development Jun 1, 2024
1 check passed
@eatyourpeas eatyourpeas deleted the fix-otp-local-dev branch June 1, 2024 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants