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
1d11345e
Commit
1d11345e
authored
Mar 30, 2015
by
jsa
Committed by
Andy Armstrong
Apr 17, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make auto_auth users satisfy PARENTAL_CONSENT_AGE_LIMIT
parent
7330b2bf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
2 deletions
+11
-2
common/djangoapps/student/tests/test_auto_auth.py
+3
-1
common/djangoapps/student/views.py
+8
-1
No files found.
common/djangoapps/student/tests/test_auto_auth.py
View file @
1d11345e
...
...
@@ -43,7 +43,9 @@ class AutoAuthEnabledTestCase(UrlResetMixin, TestCase):
"""
self
.
_auto_auth
()
self
.
assertEqual
(
User
.
objects
.
count
(),
1
)
self
.
assertTrue
(
User
.
objects
.
all
()[
0
]
.
is_active
)
user
=
User
.
objects
.
all
()[
0
]
self
.
assertTrue
(
user
.
is_active
)
self
.
assertFalse
(
user
.
profile
.
requires_parental_consent
())
def
test_create_same_user
(
self
):
self
.
_auto_auth
(
username
=
'test'
)
...
...
common/djangoapps/student/views.py
View file @
1d11345e
...
...
@@ -1758,13 +1758,14 @@ def auto_auth(request):
# If successful, this will return a tuple containing
# the new user object.
try
:
user
,
_
profile
,
reg
=
_do_create_account
(
form
)
user
,
profile
,
reg
=
_do_create_account
(
form
)
except
AccountValidationError
:
# Attempt to retrieve the existing user.
user
=
User
.
objects
.
get
(
username
=
username
)
user
.
email
=
email
user
.
set_password
(
password
)
user
.
save
()
profile
=
UserProfile
.
objects
.
get
(
user
=
user
)
reg
=
Registration
.
objects
.
get
(
user
=
user
)
# Set the user's global staff bit
...
...
@@ -1776,6 +1777,12 @@ def auto_auth(request):
reg
.
activate
()
reg
.
save
()
# ensure parental consent threshold is met
year
=
datetime
.
date
.
today
()
.
year
age_limit
=
settings
.
PARENTAL_CONSENT_AGE_LIMIT
profile
.
year_of_birth
=
(
year
-
age_limit
)
-
1
profile
.
save
()
# Enroll the user in a course
if
course_key
is
not
None
:
CourseEnrollment
.
enroll
(
user
,
course_key
)
...
...
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