diff --git a/containers/backend/api/migrations/0007_add_encrypted_password_profile.py b/containers/backend/api/migrations/0007_add_encrypted_password_profile.py new file mode 100644 index 0000000..1f6b44f --- /dev/null +++ b/containers/backend/api/migrations/0007_add_encrypted_password_profile.py @@ -0,0 +1,34 @@ +# Generated by Django 3.0.7 on 2020-07-25 21:45 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0006_change_default_password_profile'), + ] + + operations = [ + migrations.AddField( + model_name='lesspassuser', + name='has_password_profile_encrypted', + field=models.BooleanField(default=False), + ), + migrations.CreateModel( + name='EncryptedPasswordProfile', + fields=[ + ('created', models.DateTimeField(auto_now_add=True, verbose_name='created')), + ('modified', models.DateTimeField(auto_now=True, verbose_name='modified')), + ('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False)), + ('version', models.TextField()), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='encrypted_password_profile', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'abstract': False, + }, + ), + ] diff --git a/containers/backend/api/models.py b/containers/backend/api/models.py index 0c4054e..75b0dd7 100644 --- a/containers/backend/api/models.py +++ b/containers/backend/api/models.py @@ -29,6 +29,7 @@ class LessPassUser(AbstractBaseUser): email = models.EmailField(verbose_name='email address', max_length=255, unique=True) is_active = models.BooleanField(default=True) is_admin = models.BooleanField(default=False) + has_password_profile_encrypted = models.BooleanField(default=False) objects = LesspassUserManager() @@ -91,7 +92,7 @@ class Password(DateMixin): class EncryptedPasswordProfile(DateMixin): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) - user = models.ForeignKey(LessPassUser, on_delete=models.CASCADE, related_name='passwords') + user = models.ForeignKey(LessPassUser, on_delete=models.CASCADE, related_name='encrypted_password_profile') version = models.TextField() def __str__(self):