Browse Source

fix VPNUser creation

master
alice 1 month ago
parent
commit
c6bc79f342
1 changed files with 6 additions and 2 deletions
  1. +6
    -2
      lambdainst/models.py

+ 6
- 2
lambdainst/models.py View File

@@ -4,6 +4,7 @@ from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from django.db.models.signals import post_save
from django.db import IntegrityError
from django.dispatch import receiver
from constance import config as site_config
from django_lcore.core import LcoreUserProfileMethods, setup_sync_hooks, VPN_AUTH_STORAGE
@@ -99,8 +100,11 @@ setup_sync_hooks(User, VPNUser)

@receiver(post_save, sender=User)
def create_vpnuser(sender, instance, created, **kwargs):
if created and not instance.vpnuser:
VPNUser.objects.create(user=instance)
if created:
try:
VPNUser.objects.create(user=instance)
except IntegrityError:
pass


class GiftCode(models.Model):


Loading…
Cancel
Save