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
f993a484
Commit
f993a484
authored
Dec 03, 2014
by
stephensanchez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only allow users who turned 13 before this year began to opt in.
parent
3c999122
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
common/djangoapps/user_api/api/profile.py
+1
-1
common/djangoapps/user_api/tests/test_profile_api.py
+5
-2
No files found.
common/djangoapps/user_api/api/profile.py
View file @
f993a484
...
...
@@ -191,7 +191,7 @@ def update_email_opt_in(username, org, optin):
profile
=
UserProfile
.
objects
.
get
(
user
=
user
)
of_age
=
(
profile
.
year_of_birth
is
None
or
# If year of birth is not set, we assume user is of age.
datetime
.
datetime
.
now
(
UTC
)
.
year
-
profile
.
year_of_birth
>
=
# pylint: disable=maybe-no-member
datetime
.
datetime
.
now
(
UTC
)
.
year
-
profile
.
year_of_birth
>
# pylint: disable=maybe-no-member
getattr
(
settings
,
'EMAIL_OPTIN_MINIMUM_AGE'
,
13
)
)
...
...
common/djangoapps/user_api/tests/test_profile_api.py
View file @
f993a484
...
...
@@ -105,8 +105,11 @@ class ProfileApiTest(TestCase):
# Check that a 32-year old can opt-out
(
32
,
False
,
u"False"
),
# Check that someone 13 years old can opt-in
(
13
,
True
,
u"True"
),
# Check that someone 14 years old can opt-in
(
14
,
True
,
u"True"
),
# Check that someone 13 years old cannot opt-in (must have turned 13 before this year)
(
13
,
True
,
u"False"
),
# Check that someone 12 years old cannot opt-in
(
12
,
True
,
u"False"
)
...
...
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