add Friendrequests
This commit is contained in:
parent
e447f389d8
commit
0d394d531b
2 changed files with 4 additions and 2 deletions
|
@ -60,6 +60,8 @@ def verify_incoming_friend_request(request, raw_request_body):
|
||||||
befriender_key = request.data['befriender_key']
|
befriender_key = request.data['befriender_key']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
return False
|
return False
|
||||||
|
if not befriender or not befriender_key:
|
||||||
|
return False
|
||||||
if username + "@" + domain != befriender:
|
if username + "@" + domain != befriender:
|
||||||
return False
|
return False
|
||||||
if len(befriender_key) != 64:
|
if len(befriender_key) != 64:
|
||||||
|
|
|
@ -72,7 +72,7 @@ class FriendsRequests(APIView, ViewSetMixin):
|
||||||
befriender_username=befriender_username,
|
befriender_username=befriender_username,
|
||||||
befriender_domain=befriender_domain,
|
befriender_domain=befriender_domain,
|
||||||
befriender_public_key=user.public_identity.public_key,
|
befriender_public_key=user.public_identity.public_key,
|
||||||
secret=secret, # request.data['secret'] # TODO ??
|
secret=secret,
|
||||||
befriendee_user=befriendee_user.get(),
|
befriendee_user=befriendee_user.get(),
|
||||||
)
|
)
|
||||||
return Response(status=status.HTTP_201_CREATED, data={'secret': secret, 'status': "pending"})
|
return Response(status=status.HTTP_201_CREATED, data={'secret': secret, 'status': "pending"})
|
||||||
|
@ -81,7 +81,7 @@ class FriendsRequests(APIView, ViewSetMixin):
|
||||||
befriender_user=user,
|
befriender_user=user,
|
||||||
befriendee_username=befriendee_username,
|
befriendee_username=befriendee_username,
|
||||||
befriendee_domain=befriendee_domain,
|
befriendee_domain=befriendee_domain,
|
||||||
secret=secret, # request.data['secret'] # TODO ??
|
secret=secret,
|
||||||
)
|
)
|
||||||
return Response(status=status.HTTP_201_CREATED, data={'secret': secret, 'status': "pending"})
|
return Response(status=status.HTTP_201_CREATED, data={'secret': secret, 'status': "pending"})
|
||||||
elif verify_incoming_friend_request(request, raw_request):
|
elif verify_incoming_friend_request(request, raw_request):
|
||||||
|
|
Loading…
Reference in a new issue