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
08a8afa6
Commit
08a8afa6
authored
Dec 12, 2014
by
David Baumgold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
For methods on PasswordHistory, only calculate if necessary
Check settings.FEATURES["ADVANCED_SECURITY"] first
parent
4fcf1f9e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
common/djangoapps/student/models.py
+15
-5
No files found.
common/djangoapps/student/models.py
View file @
08a8afa6
...
...
@@ -452,50 +452,60 @@ class PasswordHistory(models.Model):
"""
Returns whether the configuration which limits password reuse has been turned on
"""
if
not
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]:
return
False
min_diff_pw
=
settings
.
ADVANCED_SECURITY_CONFIG
.
get
(
'MIN_DIFFERENT_STUDENT_PASSWORDS_BEFORE_REUSE'
,
0
)
return
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]
and
min_diff_pw
>
0
return
min_diff_pw
>
0
@classmethod
def
is_staff_password_reuse_restricted
(
cls
):
"""
Returns whether the configuration which limits password reuse has been turned on
"""
if
not
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]:
return
False
min_diff_pw
=
settings
.
ADVANCED_SECURITY_CONFIG
.
get
(
'MIN_DIFFERENT_STAFF_PASSWORDS_BEFORE_REUSE'
,
0
)
return
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]
and
min_diff_pw
>
0
return
min_diff_pw
>
0
@classmethod
def
is_password_reset_frequency_restricted
(
cls
):
"""
Returns whether the configuration which limits the password reset frequency has been turned on
"""
if
not
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]:
return
False
min_days_between_reset
=
settings
.
ADVANCED_SECURITY_CONFIG
.
get
(
'MIN_TIME_IN_DAYS_BETWEEN_ALLOWED_RESETS'
)
return
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]
and
min_days_between_reset
return
min_days_between_reset
@classmethod
def
is_staff_forced_password_reset_enabled
(
cls
):
"""
Returns whether the configuration which forces password resets to occur has been turned on
"""
if
not
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]:
return
False
min_days_between_reset
=
settings
.
ADVANCED_SECURITY_CONFIG
.
get
(
'MIN_DAYS_FOR_STAFF_ACCOUNTS_PASSWORD_RESETS'
)
return
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]
and
min_days_between_reset
return
min_days_between_reset
@classmethod
def
is_student_forced_password_reset_enabled
(
cls
):
"""
Returns whether the configuration which forces password resets to occur has been turned on
"""
if
not
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]:
return
False
min_days_pw_reset
=
settings
.
ADVANCED_SECURITY_CONFIG
.
get
(
'MIN_DAYS_FOR_STUDENT_ACCOUNTS_PASSWORD_RESETS'
)
return
settings
.
FEATURES
[
'ADVANCED_SECURITY'
]
and
min_days_pw_reset
return
min_days_pw_reset
@classmethod
def
should_user_reset_password_now
(
cls
,
user
):
...
...
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