Invitation: fix the checks making sure you can't invite yourself.
This commit is contained in:
parent
9f1bfceda7
commit
41a03e9d3b
@ -294,7 +294,7 @@ class CollectionInvitationSerializer(serializers.ModelSerializer):
|
|||||||
def validate_user(self, value):
|
def validate_user(self, value):
|
||||||
request = self.context['request']
|
request = self.context['request']
|
||||||
|
|
||||||
if request.user == value.lower():
|
if request.user.username == value.lower():
|
||||||
raise serializers.ValidationError('Inviting yourself is not allowed')
|
raise serializers.ValidationError('Inviting yourself is not allowed')
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user