Browse Source

add boolean to check if user is using encrypted profile

pull/567/head
Bianca Rosa 4 years ago
parent
commit
8d6917033d
No known key found for this signature in database GPG Key ID: A5551D6B3C1EBA55
2 changed files with 36 additions and 1 deletions
  1. +34
    -0
      containers/backend/api/migrations/0007_add_encrypted_password_profile.py
  2. +2
    -1
      containers/backend/api/models.py

+ 34
- 0
containers/backend/api/migrations/0007_add_encrypted_password_profile.py View File

@@ -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,
},
),
]

+ 2
- 1
containers/backend/api/models.py View File

@@ -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):

Loading…
Cancel
Save