Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion api/users/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,6 @@ def get(self, request, *args, **kwargs):
)
return Response(status=status.HTTP_200_OK, data={'message': status_message, 'kind': kind, 'institutional': institutional})

@method_decorator(csrf_protect)
def post(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
Expand Down
5 changes: 2 additions & 3 deletions api_tests/users/views/test_user_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ def test_get_invalid_email(self, app, url):
assert res.status_code == 200
assert not mock_send_mail.called

def test_post(self, app, url, user_one, csrf_token):
app.set_cookie(CSRF_COOKIE_NAME, csrf_token)
def test_post(self, app, url, user_one):
encoded_email = urllib.parse.quote(user_one.email)
url = f'{url}?email={encoded_email}'
res = app.get(url)
Expand All @@ -227,7 +226,7 @@ def test_post(self, app, url, user_one, csrf_token):
}
}

res = app.post_json_api(url, payload, headers={'X-CSRFToken': csrf_token})
res = app.post_json_api(url, payload)
user_one.reload()
assert res.status_code == 200
assert user_one.check_password('password2')
Expand Down
Loading