LT-97: Add requireRegexValidation and requireStrongPasswords properties under passwordOptions which is under passwordOptions.

- requireRegexValidation toggles whether or not password validation is controlled by regular expression
- requireStrongPasswords toggles whether password validation is controlled by zxcvbn package
LT-104: User account shall be locked after 5 failed attempts
- "failedAttemptsLimit" property which is under passwordOptions in ActiveEntry configuration object sets number of failed attempts count to lock user account, it is set 5 as default
LT-99: Passwords shall use password history of 6
- "passwordHistoryCount" property which is under passwordOptions in ActiveEntry configuration object sets count of last passwords that is not used to reset password
- Show error messages in changePassword template
- Make signIn button disabled if inputs are not validated
This commit is contained in:
Aysel Afsar committed 2016-02-14 17:03:00 -05:00
1 parent 24e615da1e
commit eb32e1771f
15 files changed
+250 -49

No files matched your search

@@ -8,6 +8,14 @@
<div id="changePasswordPageMessage" class="subtitle-auth" style="{{getChangePasswordMessageColor}}">{{getChangePasswordMessage}}</div>
<form>
{{#if entryErrorMessages}}
<div id="errorMessages" class="list-errors">
{{#each entryErrorMessages}}
<div class="alert alert-danger list-item">{{this}}</div>
{{/each}}
</div>
{{/if}}
<div class="input-symbol">
<input id="changePasswordPageOldPasswordInput" type="password" name="oldPassword" placeholder="Old Password" style="{{getPasswordStyling}}" />
<span class="fa fa-lock" title="Password"></span>
@@ -44,9 +44,20 @@ Template.changePassword.helpers({
} else {
return "border: 1px solid gray";
}
},
entryErrorMessages: function() {
var errorMessages = [];
Object.keys(ActiveEntry.errorMessages.all()).forEach(function(key) {
if ((key === "password" || key === "confirm") && ActiveEntry.errorMessages.get(key)) {
errorMessages.push(ActiveEntry.errorMessages.get(key));
}
});
return errorMessages;
}
});
Template.changePassword.events({
'change, keyup #changePasswordPagePasswordInput': function (event, template) {
var password = $('[name="password"]').val();
@@ -73,12 +84,37 @@ Template.changePassword.events({
ActiveEntry.verifyConfirmPassword(password, confirmPassword);
ActiveEntry.errorMessages.set('changePasswordError', null);
Accounts.changePassword(oldPassword, confirmPassword, function(error) {
if (error) {
console.warn(error);
return;
}
console.log('Password changed!');
});
if (ActiveEntry.successMessages.get('password') && ActiveEntry.successMessages.get('confirm') && oldPassword) {
Meteor.call("checkPasswordExistence", new String(password).hashCode(), function(error, result) {
if (error) {
console.warn(error.message);
ActiveEntry.errorMessages.set('changePasswordError', error.message);
} else {
if (result) {
ActiveEntry.errorMessages.set('changePasswordError', 'Password is used before. Please change your new password.');
} else {
ActiveEntry.errorMessages.set('changePasswordError', null);
// If password is not found in password history, change the password
Accounts.changePassword(oldPassword, confirmPassword, function(error) {
if (error) {
console.warn(error);
ActiveEntry.errorMessages.set('changePasswordError', error.message);
} else {
// Save the new password
ActiveEntry.insertHashedPassword(confirmPassword);
// Logout
ActiveEntry.signOut();
// Go to signIn page for new entry
Router.go('/entrySignIn');
}
});
}
}
});
}
}
});