forked from TryGhost/Ghost
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Improved password validation rules (TryGhost#9171)
refs TryGhost#9150 - Moves the password length fn from `models/user` to `data/validation` where the other validator functions live. - Added password validation rules. Password rules added: - Disallow obviously bad passwords: '1234567890', 'qwertyuiop', 'asdfghjkl;' and 'asdfghjklm' for example - Disallow passwords that contain the words 'password' or 'ghost' - Disallow passwords that match the user's email address - Disallow passwords that match the blog domain or blog title - Disallow passwords that include 50% or more of the same characters: 'aaaaaaaaaa', '1111111111' and 'ababababab' for example. - Password validation returns an `Object` now, that includes an `isValid` and `message` property to differentiate between the two error messages (password too short or password insecure). - Use a catch predicate in `api/authentication` on `passwordReset`, so the correct `ValidationError` will be thrown during the password reset flow rather then an `UnauthorizedError`. - When in setup flow, the blog title is not available yet from `settingsCache`. We therefore supply it from the received form data in the user model `setup` method to have it accessible for the validation.
- Loading branch information
1 parent
05729d2
commit c8cbbc4
Showing
9 changed files
with
257 additions
and
32 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 |
---|---|---|
|
@@ -66,7 +66,7 @@ describe('Authentication API', function () { | |
var setupData = { | ||
name: 'test user', | ||
email: '[email protected]', | ||
password: 'areallygoodpassword', | ||
password: 'thisissupersafe', | ||
blogTitle: 'a test blog' | ||
}; | ||
|
||
|
@@ -103,7 +103,7 @@ describe('Authentication API', function () { | |
var setupData = { | ||
name: 'test user', | ||
email: '[email protected]', | ||
password: 'areallygoodpassword', | ||
password: 'thisissupersafe', | ||
blogTitle: 'a test blog' | ||
}; | ||
|
||
|
@@ -128,7 +128,7 @@ describe('Authentication API', function () { | |
var setupData = { | ||
name: 'test user', | ||
email: '[email protected]', | ||
password: 'areallygoodpassword' | ||
password: 'thisissupersafe' | ||
}; | ||
|
||
AuthAPI.setup({setup: [setupData]}).then(function (result) { | ||
|
@@ -223,7 +223,7 @@ describe('Authentication API', function () { | |
var setupData = { | ||
name: 'test user', | ||
email: '[email protected]', | ||
password: 'areallygoodpassword', | ||
password: 'thisissupersafe', | ||
blogTitle: 'a test blog' | ||
}; | ||
|
||
|
@@ -273,7 +273,7 @@ describe('Authentication API', function () { | |
token: invite.get('token'), | ||
email: invite.get('email'), | ||
name: invite.get('email'), | ||
password: 'eightcharacterslong' | ||
password: 'tencharacterslong' | ||
} | ||
] | ||
}); | ||
|
@@ -313,7 +313,7 @@ describe('Authentication API', function () { | |
token: invite.get('token'), | ||
email: invite.get('email'), | ||
name: invite.get('email'), | ||
password: 'eightcharacterslong' | ||
password: 'tencharacterslong' | ||
} | ||
] | ||
}); | ||
|
@@ -409,7 +409,7 @@ describe('Authentication API', function () { | |
var user = { | ||
name: 'uninvited user', | ||
email: '[email protected]', | ||
password: '1234567890', | ||
password: 'thisissupersafe', | ||
status: 'active' | ||
}, | ||
options = { | ||
|
@@ -507,7 +507,7 @@ describe('Authentication API', function () { | |
var setupData = { | ||
name: 'test user', | ||
email: '[email protected]', | ||
password: 'areallygoodpassword', | ||
password: 'thisissupersafe', | ||
blogTitle: 'a test blog' | ||
}; | ||
|
||
|
@@ -540,7 +540,7 @@ describe('Authentication API', function () { | |
var setupData = { | ||
name: 'test user', | ||
email: '[email protected]', | ||
password: 'areallygoodpassword', | ||
password: 'thisissupersafe', | ||
blogTitle: 'a test blog' | ||
}; | ||
|
||
|
@@ -573,7 +573,7 @@ describe('Authentication API', function () { | |
var setupData = { | ||
name: 'test user', | ||
email: '[email protected]', | ||
password: 'areallygoodpassword', | ||
password: 'thisissupersafe', | ||
blogTitle: 'a test blog' | ||
}; | ||
|
||
|
This file contains 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
Oops, something went wrong.