diff --git a/Packages/active-entry/components/entrySignIn/entrySignIn.js b/Packages/active-entry/components/entrySignIn/entrySignIn.js index 9f1b109c4..2cb922923 100755 --- a/Packages/active-entry/components/entrySignIn/entrySignIn.js +++ b/Packages/active-entry/components/entrySignIn/entrySignIn.js @@ -48,7 +48,7 @@ Template.entrySignIn.helpers({ return "border: 1px solid #a94442"; } else if (ActiveEntry.errorMessages.equals('email', "Email is poorly formatted")) { 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"; } else { return "border: 1px solid gray"; @@ -59,7 +59,7 @@ Template.entrySignIn.helpers({ 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.")) { 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"; } else { return "border: 1px solid gray"; diff --git a/Packages/active-entry/components/entrySignUp/entrySignUp.js b/Packages/active-entry/components/entrySignUp/entrySignUp.js index 4614546b8..a2c973046 100755 --- a/Packages/active-entry/components/entrySignUp/entrySignUp.js +++ b/Packages/active-entry/components/entrySignUp/entrySignUp.js @@ -29,7 +29,6 @@ Template.entrySignUp.helpers({ return Session.get('defaultSignInMessage'); } }, - entryErrorMessages: function () { var errorMessages = []; Object.keys(ActiveEntry.errorMessages.all()).forEach(function(key) { @@ -39,7 +38,6 @@ Template.entrySignUp.helpers({ }); return errorMessages; }, - getButtonText: function () { if (ActiveEntry.errorMessages.get('signInError')) { return ActiveEntry.errorMessages.get('signInError').message; @@ -127,30 +125,18 @@ Template.entrySignUp.events({ ActiveEntry.verifyFullName(fullName); 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) { - 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( - newUser.email, - newUser.password, - newUser.confirm, - newUser.fullName + $('#signUpPageEmailInput').val(), + $('#signUpPagePasswordInput').val(), + $('#signUpPagePasswordConfirmInput').val(), + $('#signUpPageFullNameInput').val() ); } }); Template.entrySignUp.onRendered(function() { // Password strength meter for password inputs - console.log(passwordValidationSettings) if (passwordValidationSettings.usePwstrength) { this.$('#signUpPagePasswordInput').pwstrength(passwordValidationSettings.pwstrengthOptions); } diff --git a/Packages/active-entry/lib/ActiveEntry.js b/Packages/active-entry/lib/ActiveEntry.js index a013dacd3..567e1006c 100755 --- a/Packages/active-entry/lib/ActiveEntry.js +++ b/Packages/active-entry/lib/ActiveEntry.js @@ -33,19 +33,14 @@ if (Meteor.isClient) { // Success messages ActiveEntry.successMessages = new ReactiveDict('successMessages'); - } - ActiveEntry.configure = function (configObject) { if (Meteor.isClient) { Session.set('Photonic.ActiveEntry', configObject); } }; - - - ActiveEntry.verifyPassword = function (password) { if (password.length === 0) { ActiveEntry.errorMessages.set('password', 'Password is required'); @@ -60,6 +55,7 @@ ActiveEntry.verifyPassword = function (password) { } }; + ActiveEntry.verifyConfirmPassword = function (password, confirmPassword) { if (confirmPassword === password) { //ActiveEntry.errorMessages.set('confirm', 'Passwords match'); @@ -70,6 +66,7 @@ ActiveEntry.verifyConfirmPassword = function (password, confirmPassword) { ActiveEntry.successMessages.set('confirm', null); } }; + ActiveEntry.verifyEmail = function (email) { if (email.length === 0) { ActiveEntry.errorMessages.set('email', 'Email is required'); @@ -83,6 +80,7 @@ ActiveEntry.verifyEmail = function (email) { ActiveEntry.successMessages.set('email', 'Email present'); } }; + ActiveEntry.verifyFullName = function (fullName) { if (fullName.length === 0) { ActiveEntry.errorMessages.set('fullName', 'Name is required'); @@ -162,7 +160,6 @@ ActiveEntry.signUp = function (emailValue, passwordValue, confirmPassword, fullN // }); }; ActiveEntry.signOut = function (){ - ActiveEntry.reset(); Meteor.logout(); }; @@ -173,7 +170,8 @@ ActiveEntry.reset = function (){ ActiveEntry.errorMessages.set('confirm', false); ActiveEntry.errorMessages.set('password', false); }; + ActiveEntry.logoIsDisplayed = function (){ var ActiveEntryConfig = Session.get('Photonic.ActiveEntry'); return ActiveEntryConfig.logo.displayed; -} +}; diff --git a/Packages/active-entry/tests/gagarin/activeEntryTests.js b/Packages/active-entry/tests/gagarin/activeEntryTests.js index 8903f5863..5a514bcc6 100644 --- a/Packages/active-entry/tests/gagarin/activeEntryTests.js +++ b/Packages/active-entry/tests/gagarin/activeEntryTests.js @@ -72,7 +72,7 @@ describe('clinical:active-entry', function () { it('Password match validation confirms that two passwords are the same.', function () { return client.execute(function (a) { 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'); expect(ActiveEntry.successMessages.get('confirm')).to.equal("Passwords match"); @@ -97,8 +97,8 @@ describe('clinical:active-entry', function () { // ActiveEntry.signIn it('Newly created user record should have role, profile, and name set.', function () { return client.execute(function () { - ActiveEntry.signUp('janedoe@test.org', 'janedoe123', 'janedoe123', 'Jane Doe'); - expect(ActiveEntry.errorMessages.get('fullName')).to.equal("Name present"); + ActiveEntry.signUp('janedoe@test.org', 'Janed*e123', 'Janed*e123', 'Jane Doe'); + expect(ActiveEntry.successMessages.get('fullName')).to.equal("Name present"); }).then(function (){ return server.wait(300, 'until account is created on the server', function () { 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 () { return client.execute(function () { expect(Meteor.userId()).to.not.exist; - ActiveEntry.signIn('janedoe@test.org', 'janedoe123'); + ActiveEntry.signIn('janedoe@test.org', 'Janed*e123'); }).then(function (){ client.wait(3000, "for user to sign in", function (){ 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 () { return client.execute(function () { expect(Meteor.userId()).to.not.exist; - ActiveEntry.signIn('janedoe@test.org', 'janedoe123'); + ActiveEntry.signIn('janedoe@test.org', 'Janed*e123'); }).then(function (){ client.wait(3000, "for user to sign in", function (){ expect(Meteor.userId()).to.exist;