Skip to content
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

Adding support for optional Password Policy #3032

Merged
merged 26 commits into from
Nov 17, 2016
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
05cc0d9
Introducing passwordPolicy with resetTokenValidityDuration
bhaskaryasa Nov 7, 2016
bbd5d37
validator added to passwordPolicy
bhaskaryasa Nov 8, 2016
96920bd
Add some unit tests for passwordPolicy.validator
bhaskaryasa Nov 9, 2016
e7307be
Add unit test for reset password failure for non-conformance
bhaskaryasa Nov 9, 2016
3206b34
Update README.md for passwordPolicy
bhaskaryasa Nov 9, 2016
052d6eb
Added code to handle Parse.Error from rest.update in UserController.u…
bhaskaryasa Nov 10, 2016
6bbdbbe
Merge branch 'password-policy' of https://github.com/bhaskaryasa/pars…
bhaskaryasa Nov 10, 2016
838d7cb
Added optional setting to disallow username in password
bhaskaryasa Nov 10, 2016
54bf4d1
fdescribe -> describe
bhaskaryasa Nov 10, 2016
59fb9d7
updated PasswordPolicy.spec.js to use request-promise
bhaskaryasa Nov 11, 2016
e82e1bf
passwordPolicy.validator split into two separate options - RegExp and…
bhaskaryasa Nov 11, 2016
2f0fcd7
Introducing passwordPolicy with resetTokenValidityDuration
bhaskaryasa Nov 7, 2016
f41747b
validator added to passwordPolicy
bhaskaryasa Nov 8, 2016
3cd904e
Add some unit tests for passwordPolicy.validator
bhaskaryasa Nov 9, 2016
f385f6a
Add unit test for reset password failure for non-conformance
bhaskaryasa Nov 9, 2016
5b868f6
Update README.md for passwordPolicy
bhaskaryasa Nov 9, 2016
1c1a515
Added code to handle Parse.Error from rest.update in UserController.u…
bhaskaryasa Nov 10, 2016
bd1673d
Added optional setting to disallow username in password
bhaskaryasa Nov 10, 2016
45ee8b5
fdescribe -> describe
bhaskaryasa Nov 10, 2016
f7ce2c7
updated PasswordPolicy.spec.js to use request-promise
bhaskaryasa Nov 11, 2016
838eb27
passwordPolicy.validator split into two separate options - RegExp and…
bhaskaryasa Nov 11, 2016
a9f55f8
fixed some typos
bhaskaryasa Nov 11, 2016
7401000
expect username parameter in redirect to password_reset_success
bhaskaryasa Nov 11, 2016
4ce59aa
pull from origin
bhaskaryasa Nov 11, 2016
9ed141c
Fix postgres issue for _perishable_token_expires_at
bhaskaryasa Nov 12, 2016
72a0670
fix for _perishable_token_expires_at
bhaskaryasa Nov 12, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/Controllers/UserController.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,13 @@ export class UserController extends AdaptableController {
.then(() => this.config.database.update('_User', { username }, {
_perishable_token: {__op: 'Delete'},
_perishable_token_expires_at: {__op: 'Delete'}
}));
}),(error) => {
if (error.message) { // in case of Parse.Error, fail with the error message only
return Promise.reject(error.message);
} else {
return Promise.reject(error);
}
});
}

defaultVerificationEmail({link, user, appName, }) {
Expand All @@ -202,11 +208,6 @@ export class UserController extends AdaptableController {

// Mark this private
function updateUserPassword(userId, password, config) {
// check if the password confirms to the defined password policy if configured
if (config.passwordPolicy && config.passwordPolicy.validator && !config.passwordPolicy.validator(password)) {
return Promise.reject('Password does not confirm to the Password Policy.')
}

return rest.update(config, Auth.master(config), '_User', userId, {
password: password
});
Expand Down
2 changes: 1 addition & 1 deletion src/cli/definitions/parse-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export default {
},
"passwordPolicy": {
env: "PARSE_SERVER_PASSWORD_POLICY",
help: "Password policy for reset link expiry",
help: "Password policy for enforcing password related rules",
action: objectParser
},
"appName": {
Expand Down