Skip to content

Commit

Permalink
chore: add Salt field to user pin model (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
Salaton committed Nov 15, 2021
1 parent d3c65f5 commit 88b5d77
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
18 changes: 18 additions & 0 deletions mycarehub/common/migrations/0008_rename_user_id_contact_user.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2021-11-15 11:36

from django.db import migrations


class Migration(migrations.Migration):

dependencies = [
('common', '0007_auto_20211115_1045'),
]

operations = [
migrations.RenameField(
model_name='contact',
old_name='user_id',
new_name='user',
),
]
2 changes: 1 addition & 1 deletion mycarehub/common/models/common_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ class ContactType(models.TextChoices):
contact_type = models.CharField(choices=ContactType.choices, max_length=16)
contact_value = models.TextField(unique=True)
opted_in = models.BooleanField(default=False)
user_id = models.ForeignKey(User, on_delete=models.PROTECT, null=True)
user = models.ForeignKey(User, on_delete=models.PROTECT, null=True)


class AuditLog(AbstractBase):
Expand Down
18 changes: 18 additions & 0 deletions mycarehub/users/migrations/0006_userpin_salt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.9 on 2021-11-15 11:36

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('users', '0005_user_terms_accepted'),
]

operations = [
migrations.AddField(
model_name='userpin',
name='salt',
field=models.TextField(null=True),
),
]
1 change: 1 addition & 0 deletions mycarehub/users/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class UserPIN(Model):

user = ForeignKey(User, on_delete=PROTECT)
hashed_pin = TextField()
salt = TextField(null=True)
valid_from = DateTimeField(default=timezone.now)
valid_to = DateTimeField(default=timezone.now)
user_type = CharField(choices=UserTypes.choices, max_length=32, null=True, blank=True)
Expand Down

0 comments on commit 88b5d77

Please sign in to comment.