add app user management allauth
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from django.db import models
|
||||
from django.utils.text import slugify
|
||||
|
||||
# Create your models here.
|
||||
|
||||
@@ -6,14 +7,17 @@ class PasswordEntry(models.Model):
|
||||
site = models.CharField(max_length=255)
|
||||
username = models.CharField(max_length=255)
|
||||
password = models.TextField()
|
||||
client_id = models.CharField(max_length=255)
|
||||
topic = models.CharField(max_length=255)
|
||||
role = models.CharField(max_length=255)
|
||||
acls = models.JSONField()
|
||||
status = models.CharField(max_length=255)
|
||||
slug = models.SlugField(default="", null=True)
|
||||
client_id = models.CharField(max_length=255, blank=True)
|
||||
topic = models.CharField(max_length=255, blank=True)
|
||||
status = models.CharField(max_length=255, blank=True)
|
||||
slug = models.SlugField(unique=True, blank=True)
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.slug:
|
||||
self.slug = slugify(self.username, self.site) # Automatically generate slug from the title
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('site', 'username', 'client_id')
|
||||
|
||||
@@ -21,5 +25,8 @@ class PasswordEntry(models.Model):
|
||||
return self.username
|
||||
|
||||
class MasterHash(models.Model):
|
||||
hash = models.BinaryField()
|
||||
created_at = models.DateTimeField(auto_now_add=True)
|
||||
id = models.CharField(primary_key=True, max_length=10, default="1") # Unica riga con ID fisso
|
||||
hash = models.BinaryField() # Hash bcrypt della master password
|
||||
|
||||
def __str__(self):
|
||||
return f"MasterHash(id={self.id})"
|
||||
Reference in New Issue
Block a user