Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
0971e371
Commit
0971e371
authored
Jan 29, 2016
by
Hasnain
Committed by
hasnain-naveed
Jan 29, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added check for duplication of email
parent
6e861f26
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
2 deletions
+8
-2
common/djangoapps/student/forms.py
+6
-0
common/djangoapps/student/views.py
+1
-1
common/djangoapps/third_party_auth/tests/specs/base.py
+1
-1
No files found.
common/djangoapps/student/forms.py
View file @
0971e371
...
...
@@ -243,6 +243,12 @@ class AccountCreationForm(forms.Form):
# reject the registration.
if
not
CourseEnrollmentAllowed
.
objects
.
filter
(
email
=
email
)
.
exists
():
raise
ValidationError
(
_
(
"Unauthorized email address."
))
if
User
.
objects
.
filter
(
email__iexact
=
email
)
.
exists
():
raise
ValidationError
(
_
(
"It looks like {email} belongs to an existing account. Try again with a different email address."
)
.
format
(
email
=
email
)
)
return
email
def
clean_year_of_birth
(
self
):
...
...
common/djangoapps/student/views.py
View file @
0971e371
...
...
@@ -1899,7 +1899,7 @@ def auto_auth(request):
# the new user object.
try
:
user
,
profile
,
reg
=
_do_create_account
(
form
)
except
AccountValidationError
:
except
(
AccountValidationError
,
ValidationError
)
:
# Attempt to retrieve the existing user.
user
=
User
.
objects
.
get
(
username
=
username
)
user
.
email
=
email
...
...
common/djangoapps/third_party_auth/tests/specs/base.py
View file @
0971e371
...
...
@@ -374,7 +374,7 @@ class IntegrationTest(testutil.TestCase, test.TestCase):
self
.
assertEqual
(
400
,
response
.
status_code
)
payload
=
json
.
loads
(
response
.
content
)
self
.
assertFalse
(
payload
.
get
(
'success'
))
self
.
assertIn
(
'
already exists
'
,
payload
.
get
(
'value'
))
self
.
assertIn
(
'
belongs to an existing account
'
,
payload
.
get
(
'value'
))
def
assert_json_success_response_looks_correct
(
self
,
response
):
"""Asserts the json response indicates success and redirection."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment