Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
code.vt.edu will be down for maintenance from 0530-0630 EDT Wednesday, March 26th
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
39accc0a
Commit
39accc0a
authored
6 years ago
by
Julia Eskew
Browse files
Options
Downloads
Patches
Plain Diff
Make hash generation method private.
parent
ad2cdb8c
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/djangoapps/student/models.py
+4
-4
4 additions, 4 deletions
common/djangoapps/student/models.py
common/djangoapps/student/tests/test_retirement.py
+4
-4
4 additions, 4 deletions
common/djangoapps/student/tests/test_retirement.py
with
8 additions
and
8 deletions
common/djangoapps/student/models.py
+
4
−
4
View file @
39accc0a
...
...
@@ -291,7 +291,7 @@ def get_retired_email_by_email(email):
return
user_util
.
get_retired_email
(
email
,
settings
.
RETIRED_USER_SALTS
,
settings
.
RETIRED_EMAIL_FMT
)
def
get_all_retired_usernames_by_username
(
username
):
def
_
get_all_retired_usernames_by_username
(
username
):
"""
Returns a generator of
"
retired usernames
"
, one hashed with each
configured salt. Used for finding out if the given username has
...
...
@@ -300,7 +300,7 @@ def get_all_retired_usernames_by_username(username):
return
user_util
.
get_all_retired_usernames
(
username
,
settings
.
RETIRED_USER_SALTS
,
settings
.
RETIRED_USERNAME_FMT
)
def
get_all_retired_emails_by_email
(
email
):
def
_
get_all_retired_emails_by_email
(
email
):
"""
Returns a generator of
"
retired emails
"
, one hashed with each
configured salt. Used for finding out if the given email has
...
...
@@ -315,7 +315,7 @@ def get_potentially_retired_user_by_username(username):
does not exist, then any hashed username salted with the historical
salts.
"""
locally_hashed_usernames
=
list
(
get_all_retired_usernames_by_username
(
username
))
locally_hashed_usernames
=
list
(
_
get_all_retired_usernames_by_username
(
username
))
locally_hashed_usernames
.
append
(
username
)
potential_users
=
User
.
objects
.
filter
(
username__in
=
locally_hashed_usernames
)
...
...
@@ -360,7 +360,7 @@ def get_potentially_retired_user_by_username_and_hash(username, hashed_username)
does not exist, the any hashed username salted with the historical
salts.
"""
locally_hashed_usernames
=
list
(
get_all_retired_usernames_by_username
(
username
))
locally_hashed_usernames
=
list
(
_
get_all_retired_usernames_by_username
(
username
))
if
hashed_username
not
in
locally_hashed_usernames
:
raise
Exception
(
'
Mismatched hashed_username, bad salt?
'
)
...
...
This diff is collapsed.
Click to expand it.
common/djangoapps/student/tests/test_retirement.py
+
4
−
4
View file @
39accc0a
...
...
@@ -12,8 +12,8 @@ from django.test import TestCase
import
pytest
from
student.models
import
(
get_all_retired_emails_by_email
,
get_all_retired_usernames_by_username
,
_
get_all_retired_emails_by_email
,
_
get_all_retired_usernames_by_username
,
get_potentially_retired_user_by_username
,
get_potentially_retired_user_by_username_and_hash
,
get_retired_email_by_email
,
...
...
@@ -110,7 +110,7 @@ def test_get_all_retired_usernames_by_username(retirement_user):
Check that all salts are used for this method and return expected
formats.
"""
hashed_usernames
=
list
(
get_all_retired_usernames_by_username
(
retirement_user
.
username
))
hashed_usernames
=
list
(
_
get_all_retired_usernames_by_username
(
retirement_user
.
username
))
assert
len
(
hashed_usernames
)
==
len
(
settings
.
RETIRED_USER_SALTS
)
for
hashed_username
in
hashed_usernames
:
...
...
@@ -185,7 +185,7 @@ def test_get_all_retired_email_by_email(retirement_user):
Check that all salts are used for this method and return expected
formats.
"""
hashed_emails
=
list
(
get_all_retired_emails_by_email
(
retirement_user
.
email
))
hashed_emails
=
list
(
_
get_all_retired_emails_by_email
(
retirement_user
.
email
))
assert
len
(
hashed_emails
)
==
len
(
settings
.
RETIRED_USER_SALTS
)
for
hashed_email
in
hashed_emails
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment