保存明文密码

This commit is contained in:
2025-05-09 21:28:44 +08:00
parent 917b32fcfd
commit 74337ca10d
4 changed files with 34 additions and 0 deletions

View File

@@ -41,6 +41,9 @@ class User(AbstractBaseUser):
open_api = models.BooleanField(default=False)
open_api_appkey = models.TextField(null=True)
is_disabled = models.BooleanField(default=False)
raw_password = models.CharField(
max_length=20, null=True, blank=True, verbose_name="明文密码"
)
USERNAME_FIELD = "username"
REQUIRED_FIELDS = []
@@ -64,6 +67,11 @@ class User(AbstractBaseUser):
contest.created_by == self or self.admin_type == AdminType.SUPER_ADMIN
)
def set_password(self, raw_password):
super().set_password(raw_password)
self.raw_password = raw_password
self.save()
class Meta:
db_table = "user"