Skip to content

Commit 4bc540b

Browse files
committed
Make oauthexceptions be http status 400 on signup as well
This was already done for the majority on signin, but for new accounts we should do the same.
1 parent 7959b22 commit 4bc540b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

pgweb/account/views.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
from .forms import UserForm, UserProfileForm, ContributorForm
4646
from .forms import AddEmailForm, PgwebPasswordResetForm
4747
from .oauthclient import get_encrypted_oauth_cookie, delete_encrypted_oauth_cookie_on
48+
from .oauthclient import OAuthException
4849

4950
import logging
5051

@@ -542,7 +543,10 @@ def signup_complete(request):
542543
@transaction.atomic
543544
@queryparams('do_abort')
544545
def signup_oauth(request):
545-
cookiedata = get_encrypted_oauth_cookie(request)
546+
try:
547+
cookiedata = get_encrypted_oauth_cookie(request)
548+
except OAuthException as e:
549+
return HttpResponse(e, status=400)
546550

547551
if 'oauth_email' not in cookiedata \
548552
or 'oauth_firstname' not in cookiedata \

0 commit comments

Comments
 (0)