Skip to content
Snippets Groups Projects
Commit b5fab1d9 authored by Calum Mackervoy's avatar Calum Mackervoy
Browse files

external users no account or profile locally

parent 3b4a90fa
No related branches found
No related tags found
1 merge request!50Minor: external users no account or profile locally
Pipeline #4762 passed
......@@ -158,17 +158,18 @@ def pre_create_account(sender, instance, **kwargs):
@receiver(post_save, sender=settings.AUTH_USER_MODEL)
def create_account(sender, instance, created, **kwargs):
if created:
Account.objects.create(user=instance, slug=instance.username)
chat_profile = ChatProfile.objects.create(user=instance, slug=instance.username)
if settings.JABBER_DEFAULT_HOST:
chat_profile.jabberID = '{}@{}'.format(instance.username, settings.JABBER_DEFAULT_HOST)
chat_profile.save()
else:
try:
instance.account.slug = instance.username
instance.account.save()
instance.chatProfile.slug = instance.username
instance.chatProfile.save()
except:
pass
if not Model.is_external(instance):
if created:
Account.objects.create(user=instance, slug=instance.username)
chat_profile = ChatProfile.objects.create(user=instance, slug=instance.username)
if settings.JABBER_DEFAULT_HOST:
chat_profile.jabberID = '{}@{}'.format(instance.username, settings.JABBER_DEFAULT_HOST)
chat_profile.save()
else:
try:
instance.account.slug = instance.username
instance.account.save()
instance.chatProfile.slug = instance.username
instance.chatProfile.save()
except:
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment