Added testing issues for password validation
This commit is contained in:
parent
236ab64add
commit
4e986c8395
@ -48,7 +48,7 @@ Template.entrySignIn.helpers({
|
|||||||
return "border: 1px solid #a94442";
|
return "border: 1px solid #a94442";
|
||||||
} else if (ActiveEntry.errorMessages.equals('email', "Email is poorly formatted")) {
|
} else if (ActiveEntry.errorMessages.equals('email', "Email is poorly formatted")) {
|
||||||
return "border: 1px solid #f2dede";
|
return "border: 1px solid #f2dede";
|
||||||
} else if (ActiveEntry.errorMessages.equals('email', "Email present")) {
|
} else if (ActiveEntry.successMessages.equals('email', "Email present")) {
|
||||||
return "border: 1px solid green";
|
return "border: 1px solid green";
|
||||||
} else {
|
} else {
|
||||||
return "border: 1px solid gray";
|
return "border: 1px solid gray";
|
||||||
@ -59,7 +59,7 @@ Template.entrySignIn.helpers({
|
|||||||
return "border: 1px solid #a94442";
|
return "border: 1px solid #a94442";
|
||||||
} else if (ActiveEntry.errorMessages.equals('password', "Password must have at least 8 characters. It must contain at least 1 uppercase, 1 lowercase, 1 number and 1 special character.")) {
|
} else if (ActiveEntry.errorMessages.equals('password', "Password must have at least 8 characters. It must contain at least 1 uppercase, 1 lowercase, 1 number and 1 special character.")) {
|
||||||
return "border: 1px solid #f2dede";
|
return "border: 1px solid #f2dede";
|
||||||
} else if (ActiveEntry.errorMessages.equals('password', "Password present")) {
|
} else if (ActiveEntry.successMessages.equals('password', "Password present")) {
|
||||||
return "border: 1px solid green";
|
return "border: 1px solid green";
|
||||||
} else {
|
} else {
|
||||||
return "border: 1px solid gray";
|
return "border: 1px solid gray";
|
||||||
|
|||||||
@ -29,7 +29,6 @@ Template.entrySignUp.helpers({
|
|||||||
return Session.get('defaultSignInMessage');
|
return Session.get('defaultSignInMessage');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
entryErrorMessages: function () {
|
entryErrorMessages: function () {
|
||||||
var errorMessages = [];
|
var errorMessages = [];
|
||||||
Object.keys(ActiveEntry.errorMessages.all()).forEach(function(key) {
|
Object.keys(ActiveEntry.errorMessages.all()).forEach(function(key) {
|
||||||
@ -39,7 +38,6 @@ Template.entrySignUp.helpers({
|
|||||||
});
|
});
|
||||||
return errorMessages;
|
return errorMessages;
|
||||||
},
|
},
|
||||||
|
|
||||||
getButtonText: function () {
|
getButtonText: function () {
|
||||||
if (ActiveEntry.errorMessages.get('signInError')) {
|
if (ActiveEntry.errorMessages.get('signInError')) {
|
||||||
return ActiveEntry.errorMessages.get('signInError').message;
|
return ActiveEntry.errorMessages.get('signInError').message;
|
||||||
@ -127,30 +125,18 @@ Template.entrySignUp.events({
|
|||||||
ActiveEntry.verifyFullName(fullName);
|
ActiveEntry.verifyFullName(fullName);
|
||||||
ActiveEntry.errorMessages.set('signInError', null);
|
ActiveEntry.errorMessages.set('signInError', null);
|
||||||
},
|
},
|
||||||
// TODO: this is outdated, and should be changed to match the signature/pattern in entrySignIn
|
|
||||||
'click #signUpPageJoinNowButton': function (event, template) {
|
'click #signUpPageJoinNowButton': function (event, template) {
|
||||||
event.preventDefault();
|
|
||||||
|
|
||||||
ActiveEntry.reset();
|
|
||||||
var newUser = {
|
|
||||||
fullName: template.$('[name="fullName"]').val(),
|
|
||||||
email: template.$('[name="email"]').val(),
|
|
||||||
password: template.$('[name="password"]').val(),
|
|
||||||
confirm: template.$('[name="confirm"]').val()
|
|
||||||
};
|
|
||||||
|
|
||||||
ActiveEntry.signUp(
|
ActiveEntry.signUp(
|
||||||
newUser.email,
|
$('#signUpPageEmailInput').val(),
|
||||||
newUser.password,
|
$('#signUpPagePasswordInput').val(),
|
||||||
newUser.confirm,
|
$('#signUpPagePasswordConfirmInput').val(),
|
||||||
newUser.fullName
|
$('#signUpPageFullNameInput').val()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Template.entrySignUp.onRendered(function() {
|
Template.entrySignUp.onRendered(function() {
|
||||||
// Password strength meter for password inputs
|
// Password strength meter for password inputs
|
||||||
console.log(passwordValidationSettings)
|
|
||||||
if (passwordValidationSettings.usePwstrength) {
|
if (passwordValidationSettings.usePwstrength) {
|
||||||
this.$('#signUpPagePasswordInput').pwstrength(passwordValidationSettings.pwstrengthOptions);
|
this.$('#signUpPagePasswordInput').pwstrength(passwordValidationSettings.pwstrengthOptions);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,19 +33,14 @@ if (Meteor.isClient) {
|
|||||||
|
|
||||||
// Success messages
|
// Success messages
|
||||||
ActiveEntry.successMessages = new ReactiveDict('successMessages');
|
ActiveEntry.successMessages = new ReactiveDict('successMessages');
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ActiveEntry.configure = function (configObject) {
|
ActiveEntry.configure = function (configObject) {
|
||||||
if (Meteor.isClient) {
|
if (Meteor.isClient) {
|
||||||
Session.set('Photonic.ActiveEntry', configObject);
|
Session.set('Photonic.ActiveEntry', configObject);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
ActiveEntry.verifyPassword = function (password) {
|
ActiveEntry.verifyPassword = function (password) {
|
||||||
if (password.length === 0) {
|
if (password.length === 0) {
|
||||||
ActiveEntry.errorMessages.set('password', 'Password is required');
|
ActiveEntry.errorMessages.set('password', 'Password is required');
|
||||||
@ -60,6 +55,7 @@ ActiveEntry.verifyPassword = function (password) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
ActiveEntry.verifyConfirmPassword = function (password, confirmPassword) {
|
ActiveEntry.verifyConfirmPassword = function (password, confirmPassword) {
|
||||||
if (confirmPassword === password) {
|
if (confirmPassword === password) {
|
||||||
//ActiveEntry.errorMessages.set('confirm', 'Passwords match');
|
//ActiveEntry.errorMessages.set('confirm', 'Passwords match');
|
||||||
@ -70,6 +66,7 @@ ActiveEntry.verifyConfirmPassword = function (password, confirmPassword) {
|
|||||||
ActiveEntry.successMessages.set('confirm', null);
|
ActiveEntry.successMessages.set('confirm', null);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ActiveEntry.verifyEmail = function (email) {
|
ActiveEntry.verifyEmail = function (email) {
|
||||||
if (email.length === 0) {
|
if (email.length === 0) {
|
||||||
ActiveEntry.errorMessages.set('email', 'Email is required');
|
ActiveEntry.errorMessages.set('email', 'Email is required');
|
||||||
@ -83,6 +80,7 @@ ActiveEntry.verifyEmail = function (email) {
|
|||||||
ActiveEntry.successMessages.set('email', 'Email present');
|
ActiveEntry.successMessages.set('email', 'Email present');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
ActiveEntry.verifyFullName = function (fullName) {
|
ActiveEntry.verifyFullName = function (fullName) {
|
||||||
if (fullName.length === 0) {
|
if (fullName.length === 0) {
|
||||||
ActiveEntry.errorMessages.set('fullName', 'Name is required');
|
ActiveEntry.errorMessages.set('fullName', 'Name is required');
|
||||||
@ -162,7 +160,6 @@ ActiveEntry.signUp = function (emailValue, passwordValue, confirmPassword, fullN
|
|||||||
// });
|
// });
|
||||||
};
|
};
|
||||||
ActiveEntry.signOut = function (){
|
ActiveEntry.signOut = function (){
|
||||||
ActiveEntry.reset();
|
|
||||||
Meteor.logout();
|
Meteor.logout();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -173,7 +170,8 @@ ActiveEntry.reset = function (){
|
|||||||
ActiveEntry.errorMessages.set('confirm', false);
|
ActiveEntry.errorMessages.set('confirm', false);
|
||||||
ActiveEntry.errorMessages.set('password', false);
|
ActiveEntry.errorMessages.set('password', false);
|
||||||
};
|
};
|
||||||
|
|
||||||
ActiveEntry.logoIsDisplayed = function (){
|
ActiveEntry.logoIsDisplayed = function (){
|
||||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||||
return ActiveEntryConfig.logo.displayed;
|
return ActiveEntryConfig.logo.displayed;
|
||||||
}
|
};
|
||||||
|
|||||||
@ -72,7 +72,7 @@ describe('clinical:active-entry', function () {
|
|||||||
it('Password match validation confirms that two passwords are the same.', function () {
|
it('Password match validation confirms that two passwords are the same.', function () {
|
||||||
return client.execute(function (a) {
|
return client.execute(function (a) {
|
||||||
ActiveEntry.verifyConfirmPassword('K1tt#kittens', 'kittens');
|
ActiveEntry.verifyConfirmPassword('K1tt#kittens', 'kittens');
|
||||||
expect(ActiveEntry.successMessages.get('confirm')).to.equal("Passwords do not match");
|
expect(ActiveEntry.errorMessages.get('confirm')).to.equal("Passwords do not match");
|
||||||
|
|
||||||
ActiveEntry.verifyConfirmPassword('K1tt#ns123', 'K1tt#ns123');
|
ActiveEntry.verifyConfirmPassword('K1tt#ns123', 'K1tt#ns123');
|
||||||
expect(ActiveEntry.successMessages.get('confirm')).to.equal("Passwords match");
|
expect(ActiveEntry.successMessages.get('confirm')).to.equal("Passwords match");
|
||||||
@ -97,8 +97,8 @@ describe('clinical:active-entry', function () {
|
|||||||
// ActiveEntry.signIn
|
// ActiveEntry.signIn
|
||||||
it('Newly created user record should have role, profile, and name set.', function () {
|
it('Newly created user record should have role, profile, and name set.', function () {
|
||||||
return client.execute(function () {
|
return client.execute(function () {
|
||||||
ActiveEntry.signUp('janedoe@test.org', 'janedoe123', 'janedoe123', 'Jane Doe');
|
ActiveEntry.signUp('janedoe@test.org', 'Janed*e123', 'Janed*e123', 'Jane Doe');
|
||||||
expect(ActiveEntry.errorMessages.get('fullName')).to.equal("Name present");
|
expect(ActiveEntry.successMessages.get('fullName')).to.equal("Name present");
|
||||||
}).then(function (){
|
}).then(function (){
|
||||||
return server.wait(300, 'until account is created on the server', function () {
|
return server.wait(300, 'until account is created on the server', function () {
|
||||||
return Meteor.users.findOne({'emails.address': 'janedoe@test.org'});
|
return Meteor.users.findOne({'emails.address': 'janedoe@test.org'});
|
||||||
@ -133,7 +133,7 @@ describe('clinical:active-entry', function () {
|
|||||||
it("Newly created user can sign in to the application.", function () {
|
it("Newly created user can sign in to the application.", function () {
|
||||||
return client.execute(function () {
|
return client.execute(function () {
|
||||||
expect(Meteor.userId()).to.not.exist;
|
expect(Meteor.userId()).to.not.exist;
|
||||||
ActiveEntry.signIn('janedoe@test.org', 'janedoe123');
|
ActiveEntry.signIn('janedoe@test.org', 'Janed*e123');
|
||||||
}).then(function (){
|
}).then(function (){
|
||||||
client.wait(3000, "for user to sign in", function (){
|
client.wait(3000, "for user to sign in", function (){
|
||||||
expect(Meteor.userId()).to.exist;
|
expect(Meteor.userId()).to.exist;
|
||||||
@ -143,7 +143,7 @@ describe('clinical:active-entry', function () {
|
|||||||
it("Newly created user can sign out of the application.", function () {
|
it("Newly created user can sign out of the application.", function () {
|
||||||
return client.execute(function () {
|
return client.execute(function () {
|
||||||
expect(Meteor.userId()).to.not.exist;
|
expect(Meteor.userId()).to.not.exist;
|
||||||
ActiveEntry.signIn('janedoe@test.org', 'janedoe123');
|
ActiveEntry.signIn('janedoe@test.org', 'Janed*e123');
|
||||||
}).then(function (){
|
}).then(function (){
|
||||||
client.wait(3000, "for user to sign in", function (){
|
client.wait(3000, "for user to sign in", function (){
|
||||||
expect(Meteor.userId()).to.exist;
|
expect(Meteor.userId()).to.exist;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user