兼容OAuth2

Signed-off-by: 木子-李 <1537080775@qq.com>
This commit is contained in:
木子-李
2025-05-06 05:49:02 +00:00
committed by Gitee
parent b4ffb2105f
commit 45dcda0cc0
6 changed files with 178 additions and 2 deletions

View File

@@ -77,7 +77,13 @@ class Users(CoreModel, AbstractUser):
objects = CustomUserManager()
def set_password(self, raw_password):
super().set_password(hashlib.md5(raw_password.encode(encoding="UTF-8")).hexdigest())
if raw_password:
super().set_password(hashlib.md5(raw_password.encode(encoding="UTF-8")).hexdigest())
def save(self, *args, **kwargs):
if self.name == "":
self.name = self.username
super().save(*args, **kwargs)
class Meta:
db_table = table_prefix + "system_users"