Skip to content

Commit

Permalink
only add user to group if authenticated
Browse files Browse the repository at this point in the history
  • Loading branch information
owocki committed Aug 30, 2019
1 parent b904a47 commit 61b8037
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions app/marketing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,11 @@ def handle_marketing_callback(key, request):
if callbacks.exists():
callback_reference = callbacks.first().val
if callback_reference.split(':')[0] == 'add_to_group':
from django.contrib.auth.models import Group
group_name = callback_reference.split(':')[1]
group = Group.objects.get(name=group_name)
group.user_set.add(request.user)
if request.user.is_authenticated:
from django.contrib.auth.models import Group
group_name = callback_reference.split(':')[1]
group = Group.objects.get(name=group_name)
group.user_set.add(request.user)


def func_name():
Expand Down

0 comments on commit 61b8037

Please sign in to comment.