generated from CodeYourFuture/Module-Template
-
-
Notifications
You must be signed in to change notification settings - Fork 241
Glasgow | 25-ITP-Sep | Alaa Tagi| Sprint 3 | coursework/sprint 3 stretch #765
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
Open
Alaa-Tagi
wants to merge
14
commits into
CodeYourFuture:main
Choose a base branch
from
Alaa-Tagi:coursework/sprint-3-stretch
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 9 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
24f294c
write js card-validator code with explanation of some lines and some …
Alaa-Tagi 6b8d975
answer the questions in the code
Alaa-Tagi 8499ca3
Editing passwordValidator code
Alaa-Tagi 14ab0f6
rewrite test with jest for password-validator
Alaa-Tagi e2191a4
fix the code
Alaa-Tagi 7f09ec5
fix the code
Alaa-Tagi 46024de
fix the code
Alaa-Tagi 444fbb9
fix the code
Alaa-Tagi df9863b
fix the code
Alaa-Tagi 9354edf
fixing code to meet all requirements
Alaa-Tagi d50290e
editing the code
Alaa-Tagi 9abe2c9
Change line in the code to meet at least one symbol requirement
Alaa-Tagi e615f8a
change line in the code to meet rqirements
Alaa-Tagi 08603d4
change line in the code to meet rqirements
Alaa-Tagi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,30 @@ | ||
| function passwordValidator(password) { | ||
| return password.length < 5 ? false : true | ||
| } | ||
| const passwords = ["Abcde1!", "Hello#2"]; | ||
| function passwordValidator(password) { | ||
| if (password.length < 5) { | ||
| return false; | ||
| } | ||
|
|
||
| if (!/[A-Z]/.test(password)) { | ||
| return false; | ||
| } | ||
|
|
||
| if (!/[a-z]/.test(password)) { | ||
| return false; | ||
| } | ||
|
|
||
| if (!/[0-9]/.test(password)) { | ||
| return false; | ||
| } | ||
| if (!/[!#$%&? "]/.test(password)) { | ||
| return false; | ||
| } | ||
|
|
||
| if (passwords.includes(password)) { | ||
| return false; | ||
| } | ||
|
|
||
|
|
||
| return true; | ||
| } | ||
|
|
||
| module.exports = passwordValidator; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The function can return
falsefor multiple reasons.To test a specific reason, choose an input that satisfies all other conditions except the one you're targeting. This way, if the function returns
false, you can confidently attribute it to that specific condition.For example, the function might return
falsefor "1234a" not only because it lacks an uppercase letter, but also because it lacks a special symbol.As a result, we can't be certain that the function correctly handles the case of passwords without uppercase letters, since multiple conditions are being violated simultaneously.