Added multi-factor authentication for account login#4618
Added multi-factor authentication for account login#4618mschwager wants to merge 1 commit intopypi:masterfrom mschwager:multi-factor-authentication
Conversation
|
Okay, finally appeased the linter and maintained 100% test coverage. Not sure what's up with the |
|
@mschwager The dependencies job is failing because you've added |
|
Wooo! Everything passed - thanks @di! |
|
No problem! Thanks for this work. Bear with us as it might take us a bit to fully review this. |
| with_mfa = False | ||
|
|
||
| # Upgrade to MFA form | ||
| if with_mfa and _form_class == LoginForm: |
There was a problem hiding this comment.
This check is a bit awkward. Basically, we have to check if _form_class is the default value set in the keyword argument. If we don't then testing becomes difficult because passing in a stubbed form_class will be overwritten when we set it to LoginWithMfaForm.
I typically don't like writing code that's been contorted to make tests pass, but I couldn't see a good way around it without a more significant refactor. I'm open to ideas though!
|
I just rebased on top of Looks like the Dependencies CI job is complaining again: It looks like it's complaining that |
|
@mschwager It's due to a recent release of |
|
Ahhh - thanks for the heads up! I rebased on master and it looks like it's fixed! |
|
I've rebased on top of the latest code in |
|
As @woodruffw said about a related PR:
His PR is #5567. (Context: this grant-funded project.) |
|
@mschwager Your work is one of the sources Will is learning from here -- thank you so much for it! |
Cribbed largely from pypi#4618, with some accessibility improvements.
Cribbed largely from pypi#4618, with some accessibility improvements.
Cribbed largely from pypi#4618, with some accessibility improvements.
|
Closing in favor of #5567, but thank you for your contribution! |
Fixes #996.
Hey all,
I'm hoping to get some early feedback on this MFA work. Here's the current workflow:
Visit the account management page and configure MFA
Then, when logging in, you're presented with the same primary authentication page
If MFA is enabled for that user then you'll be asked to input an authentication token
This workflow is similar to what we were discussing in IRC. There's undoubtedly some UI/UX improvements to be made, but I was hoping to get some eyes (@dstufft, @di, @sergeykolosov, others?) on this as soon as possible. Addtionally, there's some things that need to be done, and probably some that should be done, before this is ready for prime time:
Add additional MFA tests for the accounts views pageI'm about to take off for the weekend and was hoping to get this up before then :)