Skip to content

Commit

Permalink
fix: add otp fields
Browse files Browse the repository at this point in the history
  • Loading branch information
SKairinos committed Sep 27, 2023
1 parent 1d04dce commit 634d13e
Show file tree
Hide file tree
Showing 4 changed files with 109 additions and 92 deletions.
180 changes: 93 additions & 87 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Generated by Django 3.2.20 on 2023-09-27 09:04
# Generated by Django 3.2.20 on 2023-09-27 11:23

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import pyotp


class Migration(migrations.Migration):
Expand All @@ -15,8 +16,13 @@ class Migration(migrations.Migration):
operations = [
migrations.AddField(
model_name='userprofile',
name='enabled_auth_factor_csv',
field=models.TextField(default=''),
name='last_otp_for_time',
field=models.DateTimeField(null=True),
),
migrations.AddField(
model_name='userprofile',
name='otp_secret',
field=models.CharField(default=pyotp.random_base32, max_length=40),
),
migrations.AlterField(
model_name='userprofile',
Expand Down
4 changes: 3 additions & 1 deletion cfl_common/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from uuid import uuid4

import pgeocode
import pyotp
from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
Expand All @@ -18,7 +19,8 @@ class UserProfile(models.Model):
on_delete=models.CASCADE,
)

enabled_auth_factor_csv = models.TextField(default="")
otp_secret = models.CharField(max_length=40, default=pyotp.random_base32)
last_otp_for_time = models.DateTimeField(null=True)
developer = models.BooleanField(default=False)
is_verified = models.BooleanField(default=False)

Expand Down
5 changes: 4 additions & 1 deletion cfl_common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

with open("../portal/__init__.py", "r") as fd:
version = re.search(
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]', fd.read(), re.MULTILINE
r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
fd.read(),
re.MULTILINE,
).group(1)

setup(
Expand All @@ -20,6 +22,7 @@
"django-countries==7.3.1",
"pyjwt==2.6.0",
"pgeocode==0.4.0",
"pyotp==2.9.0",
],
tests_require=[],
test_suite="tests",
Expand Down

0 comments on commit 634d13e

Please sign in to comment.