mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-13 13:12:42 +00:00
Prevent creating new accounts with email registered as secondary
If an email is already added as a secondary address to one account, don't allow creating a new account using that email, unless it's removed. Otherwise we end up with the same email address attached to multiple different accounts, which can cause big problems downstream. This should never have been allowed of course, but was missed when support for secondary emails was added.
This commit is contained in:
@ -525,6 +525,10 @@ def signup_oauth(request):
|
||||
or 'oauth_lastname' not in request.session:
|
||||
return HttpSimpleResponse(request, "OAuth error", 'Invalid redirect received')
|
||||
|
||||
# Is this email already on a different account as a secondary one?
|
||||
if SecondaryEmail.objects.filter(email=request.session['oauth_email'].lower()).exists():
|
||||
return HttpSimpleResponse(request, "OAuth error", 'This email address is already attached to a different account')
|
||||
|
||||
if request.method == 'POST':
|
||||
# Second stage, so create the account. But verify that the
|
||||
# nonce matches.
|
||||
|
Reference in New Issue
Block a user