fix some bug

publicsignpoll
fxC 3 years ago
parent f49c067015
commit 34971b792a
  1. 11281
      fir_client/package-lock.json
  2. 3
      fir_ser/admin/views/celery_flower.py
  3. 2
      fir_ser/api/migrations/0001_initial.py
  4. 7
      fir_ser/api/models.py

File diff suppressed because it is too large Load Diff

@ -12,7 +12,8 @@ flower_url = f'{settings.CELERY_FLOWER_HOST}:{settings.CELERY_FLOWER_PORT}'
class CeleryFlowerView(APIView): class CeleryFlowerView(APIView):
authentication_classes = [AdminTokenAuthentication, ] if not settings.DEBUG:
authentication_classes = [AdminTokenAuthentication, ]
def get(self, request, path): def get(self, request, path):
remote_url = 'http://{}/flower/{}'.format(flower_url, path) remote_url = 'http://{}/flower/{}'.format(flower_url, path)

@ -34,7 +34,7 @@ price_info_list = [
"is_enable": True, "is_enable": True,
}, },
] ]
WEB_DOMAIN = settings.WEB_DOMAIN.split('//'[1]) WEB_DOMAIN = settings.WEB_DOMAIN.split('//')[1]
domain_cname_info_list = [ domain_cname_info_list = [
{ {
"domain_record": WEB_DOMAIN, "domain_record": WEB_DOMAIN,

@ -1,6 +1,7 @@
from django.contrib.auth.models import AbstractUser from django.contrib.auth.models import AbstractUser
from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes.models import ContentType
from django.db import models from django.db import models
from django.db.models import Count
from api.utils.TokenManager import generate_alphanumeric_token_of_length, generate_numeric_token_of_length from api.utils.TokenManager import generate_alphanumeric_token_of_length, generate_numeric_token_of_length
from api.utils.baseutils import make_random_uuid from api.utils.baseutils import make_random_uuid
@ -58,6 +59,12 @@ class UserInfo(AbstractUser):
self.uid = make_random_uuid() self.uid = make_random_uuid()
if len(self.api_token) < 8: if len(self.api_token) < 8:
self.api_token = self.uid + generate_alphanumeric_token_of_length(64) self.api_token = self.uid + generate_alphanumeric_token_of_length(64)
if not self.default_domain_name_id:
default_domain_obj = min(
DomainCnameInfo.objects.annotate(Count('userinfo')).filter(is_enable=True, is_system=True),
key=lambda x: x.userinfo__count)
if default_domain_obj:
self.default_domain_name_id = default_domain_obj.pk
super(UserInfo, self).save(*args, **kwargs) super(UserInfo, self).save(*args, **kwargs)

Loading…
Cancel
Save