Skip to content

Feature: two-factor authentication - #8012

Merged
shamoon merged 15 commits into
devfrom
feature-mfa
Nov 18, 2024
Merged

Feature: two-factor authentication#8012
shamoon merged 15 commits into
devfrom
feature-mfa

Conversation

@shamoon

@shamoon shamoon commented Oct 25, 2024

Copy link
Copy Markdown
Member

Proposed change

This pretty much entirely uses allauth's handling of totp and just kinda connects it to our frontend.

Screenshot 2024-10-25 at 10 55 34 AM Screenshot 2024-10-25 at 11 01 26 AM Screenshot 2024-10-25 at 11 01 52 AM Screenshot 2024-10-25 at 10 55 09 AM

Closes #424

Type of change

  • Bug fix: non-breaking change which fixes an issue.
  • New feature / Enhancement: non-breaking change which adds functionality. Please read the important note above.
  • Breaking change: fix or feature that would cause existing functionality to not work as expected.
  • Documentation only.
  • Other. Please explain:

Checklist:

  • I have read & agree with the contributing guidelines.
  • If applicable, I have included testing coverage for new code in this PR, for backend and / or front-end changes.
  • If applicable, I have tested my code for new features & regressions on both mobile & desktop devices, using the latest version of major browsers.
  • If applicable, I have checked that all tests pass, see documentation.
  • I have run all pre-commit hooks, see documentation.
  • I have made corresponding changes to the documentation as needed.
  • I have checked my modifications for any breaking changes.

@paperless-ngx-secretary paperless-ngx-secretary Bot added backend frontend non-trivial Requires approval by several team members labels Oct 25, 2024
@github-actions github-actions Bot added the enhancement New feature or enhancement label Oct 25, 2024
@codecov

codecov Bot commented Oct 25, 2024

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.52%. Comparing base (36ecb85) to head (f80e85e).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #8012      +/-   ##
==========================================
+ Coverage   97.50%   97.52%   +0.01%     
==========================================
  Files         475      475              
  Lines       19866    20006     +140     
  Branches     1564     1644      +80     
==========================================
+ Hits        19370    19510     +140     
+ Misses        496      493       -3     
- Partials        0        3       +3     
Flag Coverage Δ
backend 96.40% <100.00%> (+0.02%) ⬆️
frontend 98.76% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@chwiese

chwiese commented Nov 12, 2024

Copy link
Copy Markdown

Thank you for working on this @shamoon. I saw that allauth supports WebAuthn (Passkeys) for MFA. Would you consider supporting that in addition to TOTP please?

@shamoon
shamoon marked this pull request as ready for review November 13, 2024 00:20
@shamoon
shamoon requested review from a team as code owners November 13, 2024 00:20

@stumpylog stumpylog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Need to test it out too, but a couple minor thoughts

Comment thread Pipfile.lock Outdated
Comment thread src/paperless/views.py Outdated
Comment thread src/paperless/views.py Outdated
@shamoon
shamoon enabled auto-merge (squash) November 13, 2024 16:24
@stumpylog

Copy link
Copy Markdown
Member

Did some testing, all seems to work. Anyway we can customize the name? Mine came across as root@localhost. Maybe use the username of the user?

@shamoon

shamoon commented Nov 18, 2024

Copy link
Copy Markdown
Member Author

Hmm, Im not certain where the name comes from, my 2FA app doesn't really show that.

I did try setting the 'issuer':

MFA_TOTP_ISSUER = "Paperless-ngx"
and it seemed to get the email correctly for me, so for example mine comes out as: otpauth://totp/me%40example.com?secret=PQQ73YEPH3K3QACWY4DHDOZJWMLID5UP&issuer=Paperless-ngx

Is root@localhost your email you were testing with?

@stumpylog stumpylog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ah, that's the source. I don't set the email when I auto create a user

@shamoon shamoon added this to the Next Release milestone Nov 18, 2024
@shamoon
shamoon merged commit e94a92e into dev Nov 18, 2024
@shamoon
shamoon deleted the feature-mfa branch November 18, 2024 18:34
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns. See our contributing guidelines for more details.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 19, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

backend enhancement New feature or enhancement frontend non-trivial Requires approval by several team members

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants