-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added Password Validators #358
Conversation
e32deda
to
48f3de6
Compare
Your PR has finished running tests. There were no failures. |
|
||
def get_help_text(self): | ||
text = ungettext( | ||
"your password must contain at least %(min_validations)d of the following:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"your password must contain at least %(min_validations)d of the following:", | |
"your password must conform to at least %(min_validations)d of the following:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
if len(validators) >= min_validations >= 0: | ||
return | ||
elif len(validators) < min_validations: | ||
raise Exception('Number of Validators in list is lower the the minimum number of required validations.') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(validators) >= min_validations >= 0: | |
return | |
elif len(validators) < min_validations: | |
raise Exception('Number of Validators in list is lower the the minimum number of required validations.') | |
if len(validators) < min_validations: | |
raise Exception('Number of Validators in list is lower the the minimum number of required validations.') |
From what I understand from the code, we only need a single if block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
def get_help_text(self): | ||
return _( | ||
"Your password must not contain any of the following symbol: {}".format(self.restricted_symbol_text)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Your password must not contain any of the following symbol: {}".format(self.restricted_symbol_text)) | |
"Your password must not contain any of the following symbols: {}".format(self.restricted_symbol_text)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
else: | ||
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else: | |
return "" | |
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
48f3de6
to
45ca464
Compare
) % {"min_validations": self.min_validations} | ||
for validator in self.validators: | ||
if hasattr(validator, 'get_instruction_text'): | ||
text += validator.get_instruction_text() + "," |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: for multiple lines
text += validator.get_instruction_text() + "," | |
text += validator.get_instruction_text() + ", " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
|
||
def get_instruction_text(self): | ||
text = ungettext( | ||
"your password must confirm to at least %(min_validations)d of the following:", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Repeated lines (62 and 63).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Singular and Plural at the end following
and followings
. Reference: https://github.com/ucsd-ets/edx-platform/blob/develop/common/djangoapps/util/password_policy_validators.py#L177
if len(self.restricted_symbol_list) > 0: | ||
text = "" | ||
for c in self.restricted_symbol_list: | ||
if c.isspace(): | ||
text += " Space" | ||
else: | ||
text += " " + c | ||
return text | ||
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(self.restricted_symbol_list) > 0: | |
text = "" | |
for c in self.restricted_symbol_list: | |
if c.isspace(): | |
text += " Space" | |
else: | |
text += " " + c | |
return text | |
return "" | |
text = "" | |
for c in self.restricted_symbol_list: | |
if c.isspace(): | |
text += " Space" | |
else: | |
text += " " + c | |
return text |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
45ca464
to
36f833b
Compare
36f833b
to
8fcdce9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor things.
""" | ||
def __init__(self, validators=[], min_validations=0): | ||
self.check_validators_list(validators, min_validations) | ||
self.validators_list = validators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are not going to use this list anywhere, I don't think we need to save this list as self
attribute?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
try: | ||
validator_name = validator["NAME"] | ||
except KeyError: | ||
raise KeyError("Validator doesn't contains 'NAME'. Please enter valid Validator") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
raise KeyError("Validator doesn't contains 'NAME'. Please enter valid Validator") | |
raise KeyError("Validator doesn't contain 'NAME'. Please enter valid Validator") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
else: | ||
return "" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't think so 😅
75bae45
to
f19d271
Compare
f19d271
to
354edd4
Compare
Your PR has finished running tests. The following contexts failed:
|
jenkins run all |
Your PR has finished running tests. The following contexts failed:
|
jenkins run all |
Your PR has finished running tests. The following contexts failed:
|
jenkins run all |
Your PR has finished running tests. The following contexts failed:
|
Story Link
Review Password Requirements
PR Description
Added two of the password validators:
Type of change
Please select the options that are relevant.
How to test?
For testing this ticket you need to set the value of your
AUTH_PASSWORD_VALIDATORS
(located inlms.env.json
) like this:Checklist before merging: