From 02a9cd26c985ef6f03129cee56286556c038e50e Mon Sep 17 00:00:00 2001 From: Mark Beacom Date: Wed, 31 Oct 2018 12:31:53 -0400 Subject: [PATCH] Adjust unauthenticated handling on kudos send --- app/kudos/views.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/kudos/views.py b/app/kudos/views.py index 407857c7440..623aaf110cb 100644 --- a/app/kudos/views.py +++ b/app/kudos/views.py @@ -283,19 +283,21 @@ def send_2(request): This form is filled out before the 'send' button is clicked. """ - handle = request.user.username if request.user and request.user.is_authenticated else '' + if not request.user.is_authenticated or request.user.is_authenticated and not getattr(request.user, 'profile', None): + return redirect('/login/github?next=' + request.get_full_path()) + _id = request.GET.get('id') - if (_id and not str(_id).isdigit()) or not handle: + if _id and not str(_id).isdigit(): raise Http404 + kudos = Token.objects.filter(pk=_id).first() - params = { 'active': 'send', 'issueURL': request.GET.get('source'), 'class': 'send2', 'recommend_gas_price': recommend_min_gas_price_to_confirm_in_time(confirm_time_minutes_target), 'from_email': getattr(request.user, 'email', ''), - 'from_handle': handle, + 'from_handle': request.user.username, 'title': _('Send Kudos | Gitcoin'), 'card_desc': _('Send a Kudos to any github user at the click of a button.'), 'kudos': kudos,