-
Notifications
You must be signed in to change notification settings - Fork 61
✨ Adds HOTP MFA code support #206
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
Open
nefrob
wants to merge
10
commits into
merixstudio:develop
Choose a base branch
from
nefrob:nefrob/hotp-2fa-code-support
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
422c49f
:sparkles: Adds HOTP 2fa code support
nefrob ed3dfb9
:hammer: Fixes yubi issue and adds extra test check
nefrob 2987648
:recycle: Support hotp validity period
nefrob 2febbc6
🗑️ Remove unused test
nefrob d2e93e0
:recycle: Use separate hotp dispatcher
nefrob 53f1e3f
:pencil2: Lint
nefrob da8cce3
Merge remote-tracking branch 'upstream/develop' into nefrob/hotp-2fa-…
nefrob 0f338fc
:recycle: Regenerate migrations post merge
nefrob b44e787
🗑️ Delete accidental sym link commit
nefrob b5d7b7b
:elephant: Adds missing migration
nefrob File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,19 @@ | ||
| from pyotp import TOTP | ||
| from pyotp import TOTP, HOTP | ||
|
|
||
|
|
||
| class CreateOTPCommand: | ||
| class CreateTOTPCommand: | ||
| @staticmethod | ||
| def execute(secret: str, interval: int) -> TOTP: | ||
| return TOTP(secret, interval=interval) | ||
|
|
||
|
|
||
| create_otp_command = CreateOTPCommand.execute | ||
| create_totp_command = CreateTOTPCommand.execute | ||
|
|
||
|
|
||
| class CreateHOTPCommand: | ||
| @staticmethod | ||
| def execute(secret: str) -> HOTP: | ||
| return HOTP(secret) | ||
|
|
||
|
|
||
| create_hotp_command = CreateHOTPCommand.execute |
24 changes: 24 additions & 0 deletions
24
trench/migrations/0006_mfamethod_code_generated_at_mfamethod_counter.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # Generated by Django 4.1.5 on 2023-03-17 22:56 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("trench", "0005_remove_mfamethod_primary_is_active_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="mfamethod", | ||
| name="code_generated_at", | ||
| field=models.DateTimeField( | ||
| blank=True, null=True, verbose_name="code generated at" | ||
| ), | ||
| ), | ||
| migrations.AddField( | ||
| model_name="mfamethod", | ||
| name="counter", | ||
| field=models.PositiveIntegerField(default=0, verbose_name="counter"), | ||
| ), | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.