LT-97: - Remove zxcvbn package because of version conflict,
- Add passwordOptions in ActiveEntry.configure - Toggle showPasswordStrengthIndicator to show password strength meter ui, toggle requireRegexValidation to set password regex for validation or requireStrongPasswords to create strong passwords by using zxcvbn. - Sign in/ sing up when enter key is pressed
This commit is contained in:
parent
5ec3cace94
commit
24e615da1e
@ -16,7 +16,7 @@ caching-compiler@1.0.0
|
||||
caching-html-compiler@1.0.2
|
||||
callback-hook@1.0.4
|
||||
check@1.1.0
|
||||
clinical:active-entry@1.5.15
|
||||
clinical:active-entry@1.5.16
|
||||
clinical:auto-resizing@0.1.2
|
||||
clinical:error-pages@0.1.1
|
||||
clinical:extended-api@2.2.2
|
||||
@ -28,7 +28,6 @@ clinical:router-location@2.0.14
|
||||
clinical:router-middleware-stack@2.0.13
|
||||
clinical:router-url@2.0.15
|
||||
clinical:theming@0.4.7
|
||||
codetheweb:zxcvbn@4.0.1
|
||||
coffeescript@1.0.11
|
||||
cornerstone@0.0.1
|
||||
ddp@1.2.2
|
||||
|
||||
@ -15,8 +15,9 @@ if (Meteor.isClient){
|
||||
primary: ""
|
||||
},
|
||||
passwordOptions: {
|
||||
requireStrongPasswords: true,
|
||||
showPasswordStrengthIndicator: true
|
||||
showPasswordStrengthIndicator: true,
|
||||
requireRegexValidation: true
|
||||
//requireStrongPasswords: false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
## Contributing
|
||||
|
||||
**Submit your Pull Request on a Feature Branch**
|
||||
|
||||
- To ensure your pull-request has the greatest chance of getting merged in, please submit it on a feature branch rather than directly to master.
|
||||
- Please see [A successful Git branching model](http://nvie.com/posts/a-successful-git-branching-model/) for more details.
|
||||
|
||||
**Quality Assurance**
|
||||
- Pull Requests will be generally accepted as long as the QA tests pass on [Circle CI](https://circleci.com/gh/clinical-meteor/clinical-active-entry).
|
||||
- Begin a Pull Request by logging an Issue for discussion.
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
## Customize the test machine
|
||||
machine:
|
||||
node:
|
||||
version: 0.10.33
|
||||
|
||||
# Timezone
|
||||
timezone:
|
||||
@ -25,27 +27,48 @@ checkout:
|
||||
## Customize dependencies
|
||||
dependencies:
|
||||
cache_directories:
|
||||
- "~/.meteor" # relative to the user's home directory
|
||||
- ~/.meteor # relative to the user's home directory
|
||||
- ~/nvm/v0.10.33/lib/node_modules/starrynight
|
||||
- ~/nvm/v0.10.33/bin/starrynight
|
||||
|
||||
pre:
|
||||
# Install Starrynight unless it is cached
|
||||
- if [ ! -e ~/nvm/v0.10.33/bin/starrynight ]; then npm install -g starrynight; else echo "Starrynight seems to be cached"; fi;
|
||||
# Install Meteor
|
||||
- mkdir -p ${HOME}/.meteor
|
||||
# If Meteor is already cached, do not need to build it again.
|
||||
- if [ ! -e ${HOME}/.meteor/meteor ]; then curl https://install.meteor.com | /bin/sh; else echo "Meteor seems to be cached"; fi;
|
||||
# Link the meteor executable into /usr/bin
|
||||
- sudo ln -s $HOME/.meteor/meteor /usr/bin/meteor
|
||||
# Check if the helloworld directory already exists, if it doesn't, create the helloworld app
|
||||
# The following doesn't work, because it should be checking ${HOME}/active-entry/helloworld
|
||||
# - if [ ! -e ${HOME}/helloworld ]; then meteor create --release METEOR@1.1.0.3 helloworld; else echo "helloworld app seems to be cached"; fi;
|
||||
|
||||
override:
|
||||
- meteor || curl https://install.meteor.com | /bin/sh
|
||||
- npm install starrynight -g
|
||||
- meteor create --release METEOR@1.1.0.3 helloworld
|
||||
- cd helloworld
|
||||
- cd helloworld && ls -la
|
||||
- cd helloworld && rm helloworld.*
|
||||
- cd helloworld && meteor add anti:gagarin@0.4.11 accounts-base accounts-password session meteor-platform clinical:active-entry clinical:user-model
|
||||
- cd helloworld && git clone http://github.com/clinical-meteor/clinical-active-entry packages/active-entry
|
||||
- cd helloworld && starrynight autoconfig
|
||||
- cd ${HOME} && meteor create --release METEOR@1.1.0.3 helloworld
|
||||
- cd ${HOME}/helloworld
|
||||
- cd ${HOME}/helloworld && ls -la
|
||||
- cd ${HOME}/helloworld && rm helloworld.*
|
||||
- cd ${HOME}/helloworld && mkdir packages && mkdir packages/active-entry
|
||||
- cp -R * ${HOME}/helloworld/packages/active-entry
|
||||
- cd ${HOME}/helloworld && meteor add anti:gagarin@0.4.11 accounts-base accounts-password session meteor-platform clinical:user-model clinical:active-entry
|
||||
- cd ${HOME}/helloworld && starrynight autoconfig
|
||||
- cd ${HOME}/helloworld && meteor list
|
||||
- cat tests/gagarin/activeEntryTests.js
|
||||
- ls -la
|
||||
- cd ~ && ls -la
|
||||
- cd ${HOME} && pwd
|
||||
- cd ${HOME} && ls -la
|
||||
- cd ${HOME}/helloworld && ls -la
|
||||
|
||||
## Customize test commands
|
||||
test:
|
||||
pre:
|
||||
- cd helloworld && meteor:
|
||||
background: true
|
||||
- sleep 80
|
||||
- sleep 30
|
||||
override:
|
||||
- cd helloworld && starrynight run-tests --type package-verification
|
||||
- cd ${HOME}/helloworld && starrynight run-tests --type package-verification
|
||||
|
||||
## Customize deployment commands
|
||||
#deployment:
|
||||
|
||||
40
Packages/active-entry/components/changePassword/changePassword.html
Executable file
40
Packages/active-entry/components/changePassword/changePassword.html
Executable file
@ -0,0 +1,40 @@
|
||||
<template name="changePassword">
|
||||
<div id="changePassword" class="page entryPage" style="{{getOpacityWithCorner}}">
|
||||
<div class="content-scrollable">
|
||||
<div class="wrapper-auth">
|
||||
<div class="entryLogo" style="background-image: url('{{getLogoUrl}}')"></div>
|
||||
|
||||
<h1 id="changePasswordPageTitle" class="title-auth">Change Password</h1>
|
||||
<div id="changePasswordPageMessage" class="subtitle-auth" style="{{getChangePasswordMessageColor}}">{{getChangePasswordMessage}}</div>
|
||||
|
||||
<form>
|
||||
<div class="input-symbol">
|
||||
<input id="changePasswordPageOldPasswordInput" type="password" name="oldPassword" placeholder="Old Password" style="{{getPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Password"></span>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="changePasswordPagePasswordInput" type="password" name="password" placeholder="Password" style="{{getPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Password"></span>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="changePasswordPagePasswordConfirmInput" type="password" name="confirm" placeholder="Confirm Password" style="{{getConfirmPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Confirm Password"></span>
|
||||
</div>
|
||||
|
||||
<br><br>
|
||||
|
||||
<button id="changePasswordButton" type="submit" class="btn-gray btn-main btn-large" style="{{getButtonColor}}">Change Password</button>
|
||||
<br><br>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
84
Packages/active-entry/components/changePassword/changePassword.js
Executable file
84
Packages/active-entry/components/changePassword/changePassword.js
Executable file
@ -0,0 +1,84 @@
|
||||
//==========================================
|
||||
|
||||
Router.route('/changePassword', {
|
||||
name: "changePassword",
|
||||
template: "changePassword"
|
||||
});
|
||||
|
||||
|
||||
Template.changePassword.helpers({
|
||||
getChangePasswordMessageColor: function (){
|
||||
if (ActiveEntry.errorMessages.get('changePasswordError')) {
|
||||
return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;"
|
||||
} else {
|
||||
return "color: black;"
|
||||
}
|
||||
},
|
||||
getChangePasswordMessage: function (){
|
||||
if (ActiveEntry.errorMessages.get('changePasswordError')) {
|
||||
return ActiveEntry.errorMessages.get('changePasswordError');
|
||||
} else {
|
||||
return Session.get('defaultSignInMessage');
|
||||
}
|
||||
},
|
||||
getPasswordStyling: function () {
|
||||
if (ActiveEntry.errorMessages.equals('password', "Password is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('password', "Password is weak")) {
|
||||
return "border: 1px solid #f2dede";
|
||||
} else if (ActiveEntry.errorMessages.equals('password', "Password present")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
},
|
||||
getConfirmPasswordStyling: function () {
|
||||
if (ActiveEntry.errorMessages.equals('confirm', "Password is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('confirm', "Passwords do not match")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('confirm', "Password is weak")) {
|
||||
return "border: 1px solid #f2dede";
|
||||
} else if (ActiveEntry.errorMessages.equals('confirm', "Passwords match")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.changePassword.events({
|
||||
'change, keyup #changePasswordPagePasswordInput': function (event, template) {
|
||||
var password = $('[name="password"]').val();
|
||||
var confirmPassword = $('[name="confirm"]').val();
|
||||
|
||||
ActiveEntry.verifyPassword(password);
|
||||
ActiveEntry.errorMessages.set('changePasswordError', null);
|
||||
},
|
||||
'change, keyup #changePasswordPagePasswordConfirmInput': function (event, template) {
|
||||
var password = $('[name="password"]').val();
|
||||
var confirmPassword = $('[name="confirm"]').val();
|
||||
|
||||
ActiveEntry.verifyConfirmPassword(password, confirmPassword);
|
||||
ActiveEntry.errorMessages.set('changePasswordError', null);
|
||||
},
|
||||
"submit": function (event, template) {
|
||||
event.preventDefault();
|
||||
|
||||
var oldPassword = $('[name="oldPassword"]').val();
|
||||
|
||||
var password = $('[name="password"]').val();
|
||||
var confirmPassword = $('[name="confirm"]').val();
|
||||
|
||||
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!');
|
||||
});
|
||||
}
|
||||
});
|
||||
5
Packages/active-entry/components/changePassword/changePassword.less
Executable file
5
Packages/active-entry/components/changePassword/changePassword.less
Executable file
@ -0,0 +1,5 @@
|
||||
#changePassword{
|
||||
input{
|
||||
padding-left: 40px;
|
||||
}
|
||||
}
|
||||
@ -126,14 +126,13 @@ Template.entrySignIn.events({
|
||||
ActiveEntry.signIn(emailValue, passwordValue);
|
||||
event.preventDefault();
|
||||
},
|
||||
'keypress #entrySignIn': function(event, template) {
|
||||
'keyup #entrySignIn': function(event, template) {
|
||||
if(event.keyCode == 13) {
|
||||
ActiveEntry.verifyEmail($("#signInPageEmailInput").val());
|
||||
ActiveEntry.verifyPassword($("#signInPagePasswordInput").val());
|
||||
|
||||
if (!ActiveEntry.errorMessages.get('signInError') &&
|
||||
ActiveEntry.successMessages.get('email') &&
|
||||
ActiveEntry.successMessages.get('password')) {
|
||||
$("#signInPagePasswordInput").val()) {
|
||||
$("#signInToAppButton").click();
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,6 +71,8 @@ Template.entrySignUp.helpers({
|
||||
if (ActiveEntry.errorMessages.equals('confirm', "Password is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('confirm', "Passwords do not match")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('confirm', "Password is weak")) {
|
||||
return "border: 1px solid #f2dede";
|
||||
} else if (ActiveEntry.successMessages.equals('confirm', "Passwords match")) {
|
||||
return "border: 1px solid green";
|
||||
@ -133,7 +135,7 @@ Template.entrySignUp.events({
|
||||
$('#signUpPageFullNameInput').val()
|
||||
);
|
||||
},
|
||||
'keypress #entrySignUp': function(event, template) {
|
||||
'keyup #entrySignUp': function(event, template) {
|
||||
if(event.keyCode == 13) {
|
||||
ActiveEntry.verifyFullName($("#signUpPageFullNameInput").val());
|
||||
ActiveEntry.verifyEmail($("#signUpPageEmailInput").val());
|
||||
@ -153,13 +155,12 @@ Template.entrySignUp.events({
|
||||
|
||||
Template.entrySignUp.onRendered(function() {
|
||||
// Password strength meter for password inputs
|
||||
if (passwordValidationSettings.requireStrongPasswords) {
|
||||
if (passwordValidationSettings.showPasswordStrengthIndicator) {
|
||||
this.$('#signUpPagePasswordInput').pwstrength(passwordValidationSettings.pwstrengthOptions);
|
||||
}
|
||||
|
||||
// Update password warning message if zxcvbn is active
|
||||
if(passwordValidationSettings.showPasswordStrengthIndicator) {
|
||||
// Update password warning message if zxcvbn is active and zxcvbn function is defined
|
||||
if(passwordValidationSettings.requireStrongPasswords) {
|
||||
Session.set('passwordWarning', 'Password is weak');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -24,12 +24,15 @@ if (Meteor.isClient) {
|
||||
primary: ""
|
||||
},
|
||||
passwordOptions: {
|
||||
requireStrongPasswords: false,
|
||||
showPasswordStrengthIndicator: false
|
||||
showPasswordStrengthIndicator: true,
|
||||
requireRegexValidation: true
|
||||
//requireStrongPasswords: false
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// requireRegexValidation toggles regex
|
||||
// reqiureStrongPasswords toggles zxcvbn
|
||||
|
||||
if (Meteor.isClient) {
|
||||
ActiveEntry.errorMessages = new ReactiveDict('errorMessages');
|
||||
@ -56,7 +59,6 @@ ActiveEntry.verifyPassword = function (password) {
|
||||
ActiveEntry.errorMessages.set('password', Session.get('passwordWarning'));
|
||||
ActiveEntry.successMessages.set('password', null);
|
||||
} else {
|
||||
//ActiveEntry.errorMessages.set('password', 'Password present');
|
||||
ActiveEntry.errorMessages.set('password', null);
|
||||
ActiveEntry.successMessages.set('password', 'Password present');
|
||||
}
|
||||
@ -64,11 +66,15 @@ ActiveEntry.verifyPassword = function (password) {
|
||||
};
|
||||
|
||||
ActiveEntry.verifyConfirmPassword = function (password, confirmPassword) {
|
||||
if (confirmPassword === password) {
|
||||
//ActiveEntry.errorMessages.set('confirm', 'Passwords match');
|
||||
// we have two different logic checks happening in this function
|
||||
// would be reasonable to separate them out into separate functions
|
||||
if (confirmPassword === "") {
|
||||
ActiveEntry.errorMessages.set('confirm', 'Password is required');
|
||||
ActiveEntry.successMessages.set('confirm', null);
|
||||
} else if (confirmPassword === password) {
|
||||
ActiveEntry.errorMessages.set('confirm', null);
|
||||
ActiveEntry.successMessages.set('confirm', 'Passwords match');
|
||||
} else{
|
||||
} else {
|
||||
ActiveEntry.errorMessages.set('confirm', 'Passwords do not match');
|
||||
ActiveEntry.successMessages.set('confirm', null);
|
||||
}
|
||||
|
||||
@ -1,46 +1,59 @@
|
||||
passwordValidationSettings = {};
|
||||
var ActiveEntryConfiguration;
|
||||
Meteor.startup(function() {
|
||||
ActiveEntryConfiguration = Session.get('Photonic.ActiveEntry');
|
||||
var showPasswordStrengthIndicator = (ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.showPasswordStrengthIndicator || false);
|
||||
passwordValidationSettings.requireStrongPasswords = (ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.requireStrongPasswords || false);
|
||||
passwordValidationSettings.showPasswordStrengthIndicator = showPasswordStrengthIndicator;
|
||||
|
||||
passwordValidationSettings.pwstrengthOptions = {
|
||||
common: {
|
||||
minChar: 8,
|
||||
zxcvbn: showPasswordStrengthIndicator
|
||||
},
|
||||
ui: {
|
||||
showVerdictsInsideProgressBar: true,
|
||||
showStatus: true
|
||||
},
|
||||
rules: {
|
||||
activated: {
|
||||
wordNotEmail: true,
|
||||
wordTwoCharacterClasses: true,
|
||||
wordRepetitions: true
|
||||
function getPasswordValidationSettings () {
|
||||
var ActiveEntryConfiguration = Session.get('Photonic.ActiveEntry');
|
||||
var validationSettings = {};
|
||||
|
||||
validationSettings.showPasswordStrengthIndicator = ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.showPasswordStrengthIndicator || false;
|
||||
validationSettings.requireRegexValidation = ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.requireRegexValidation || false;
|
||||
|
||||
if (validationSettings.showPasswordStrengthIndicator) {
|
||||
// Set password strength meter options
|
||||
validationSettings.pwstrengthOptions = {
|
||||
common: {
|
||||
minChar: 8
|
||||
},
|
||||
ui: {
|
||||
showVerdictsInsideProgressBar: true,
|
||||
showStatus: true
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Check if codetheweb:zxcvbn is defined
|
||||
if (typeof(zxcvbn) === typeof(Function)) {
|
||||
validationSettings.requireStrongPasswords = ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.requireStrongPasswords || false;
|
||||
// Set zxcvbn in pw strength meter
|
||||
if (validationSettings.showPasswordStrengthIndicator) {
|
||||
validationSettings.pwstrengthOptions.common.zxcvbn = passwordValidationSettings.requireStrongPasswords;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return validationSettings;
|
||||
}
|
||||
|
||||
Meteor.startup(function() {
|
||||
passwordValidationSettings = getPasswordValidationSettings();
|
||||
});
|
||||
|
||||
// Check Password Strength: at least 8 characters in length and contain at least 1 uppercase, 1 lowercase and 1 number and 1 special character
|
||||
checkPasswordStrength = function(password) {
|
||||
var iszxcvbnActive = (ActiveEntryConfiguration && ActiveEntryConfiguration.passwordOptions && ActiveEntryConfiguration.passwordOptions.showPasswordStrengthIndicator || false);
|
||||
if (iszxcvbnActive) {
|
||||
// Check zxcvbn rule
|
||||
if (passwordValidationSettings.requireStrongPasswords) {
|
||||
// Check zxcvbn
|
||||
var zxcvbnResult = zxcvbn(password);
|
||||
if (zxcvbnResult.score > 2) {
|
||||
if (zxcvbnResult && zxcvbnResult.score > 2) {
|
||||
return true;
|
||||
}
|
||||
} else{
|
||||
|
||||
return false;
|
||||
} else if (passwordValidationSettings.requireRegexValidation) {
|
||||
// Apply validation rule
|
||||
var result = password.search(/^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[!@#$%^&*])[0-9a-zA-Z!@#$%^&*]{8,}$/i);
|
||||
if (result > -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
Package.describe({
|
||||
name: 'clinical:active-entry',
|
||||
version: '1.5.15',
|
||||
version: '1.5.16',
|
||||
summary: 'SignIn, SignUp, and ForgotPassword pages for Clinical Framework.',
|
||||
git: 'https://github.com/clinical-meteor/clinical-active-entry',
|
||||
documentation: 'README.md'
|
||||
@ -16,15 +16,13 @@ Package.onUse(function (api) {
|
||||
'grove:less@0.1.1',
|
||||
'session',
|
||||
'reactive-dict',
|
||||
'accounts-base',
|
||||
'accounts-password',
|
||||
'codetheweb:zxcvbn'
|
||||
//'codetheweb:zxcvbn'
|
||||
], ['client']);
|
||||
|
||||
api.use([
|
||||
'accounts-base',
|
||||
'accounts-password'
|
||||
], ['server']);
|
||||
]);
|
||||
|
||||
api.use([
|
||||
'zuuk:stale-session@1.0.8'
|
||||
@ -59,6 +57,10 @@ Package.onUse(function (api) {
|
||||
'components/forgotPassword/forgotPassword.js',
|
||||
'components/forgotPassword/forgotPassword.less',
|
||||
|
||||
'components/changePassword/changePassword.html',
|
||||
'components/changePassword/changePassword.js',
|
||||
'components/changePassword/changePassword.less',
|
||||
|
||||
], ['client']);
|
||||
|
||||
|
||||
|
||||
@ -69,13 +69,20 @@ describe('clinical:active-entry', function () {
|
||||
});
|
||||
|
||||
// ActiveEntry.verifyConfirmPassword
|
||||
it('Password match validation confirms that two passwords are the same.', function () {
|
||||
it('Password match confirms that two passwords are the same.', function () {
|
||||
return client.execute(function (a) {
|
||||
ActiveEntry.verifyConfirmPassword('K1tt#kittens', 'kittens');
|
||||
expect(ActiveEntry.errorMessages.get('confirm')).to.equal("Passwords do not match");
|
||||
|
||||
ActiveEntry.verifyConfirmPassword('kittens123', 'kittens');
|
||||
expect(ActiveEntry.errorMessages.get('confirm')).to.equal("Passwords do not match");
|
||||
|
||||
ActiveEntry.verifyConfirmPassword('kittens123', 'kittens123');
|
||||
expect(ActiveEntry.errorMessages.get('confirm')).to.equal("Passwords match");
|
||||
|
||||
ActiveEntry.verifyConfirmPassword('K1tt#ns123', 'K1tt#ns123');
|
||||
expect(ActiveEntry.successMessages.get('confirm')).to.equal("Passwords match");
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@ -94,13 +101,28 @@ 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', 'Janed*e123', 'Janed*e123', 'Jane Doe');
|
||||
// expect(ActiveEntry.successMessages.get('fullName')).to.equal("Name present");
|
||||
// }).then(function (){
|
||||
// return server.wait(500, 'until account is created on the server', function () {
|
||||
// return Meteor.users.findOne({'emails.address': 'janedoe@test.org'});
|
||||
// }).then(function (user){
|
||||
// expect(user.role).to.equal('user');
|
||||
// expect(user.profile.fullName).to.equal('Jane Doe');
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
// ActiveEntry.signIn
|
||||
it('Newly created user record should have role, profile, and name set.', function () {
|
||||
return client.execute(function () {
|
||||
ActiveEntry.signUp('janedoe@test.org', 'Janed*e123', 'Janed*e123', 'Jane Doe');
|
||||
// ActiveEntry.signUp('janedoe@test.org', 'Janed*e123', 'Janed*e123', 'Jane Doe');
|
||||
ActiveEntry.signUp('janedoe@test.org', 'Janedoe123', 'Janedoe123', '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 server.wait(500, 'until account is created on the server', function () {
|
||||
return Meteor.users.findOne({'emails.address': 'janedoe@test.org'});
|
||||
}).then(function (user){
|
||||
expect(user.role).to.equal('user');
|
||||
@ -110,7 +132,6 @@ describe('clinical:active-entry', function () {
|
||||
});
|
||||
|
||||
|
||||
|
||||
it("Newly created user should have fullName(), preferredName(), and familyName() methods.", function () {
|
||||
return server.execute(function () {
|
||||
var user = Meteor.users.findOne({'emails.address': 'janedoe@test.org'});
|
||||
@ -118,12 +139,12 @@ describe('clinical:active-entry', function () {
|
||||
expect(user.fullName()).to.equal('Jane Doe');
|
||||
expect(user.givenName()).to.equal('Jane');
|
||||
expect(user.familyName()).to.equal('Doe');
|
||||
}).then(function(){
|
||||
}).then(function (){
|
||||
// client.wait(500, "until user is logged out", function(){
|
||||
// Meteor.logout();
|
||||
// });
|
||||
return client.promise(function (resolve){
|
||||
Meteor.logout(function(error, result){
|
||||
Meteor.logout(function (error, result){
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
@ -15,6 +15,7 @@
|
||||
// existing user should be able to sign in on desktop
|
||||
// existing user should be able to sign in on tablet
|
||||
// existing user should be able to sign in on phone
|
||||
// existing user should be able to change their password
|
||||
// company logo should display on sign//in page
|
||||
|
||||
|
||||
@ -48,7 +49,6 @@ module.exports = {
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.verify.elementPresent("#signUpPageJoinNowButton");
|
||||
},
|
||||
|
||||
"guest should be notified if password is insecure": function (client) {
|
||||
client
|
||||
.clearValue("input")
|
||||
@ -158,8 +158,44 @@ module.exports = {
|
||||
.click("#logoutButton").pause(200)
|
||||
.verify.containsText("#usernameLink", "Sign In");
|
||||
},
|
||||
"if anonymous user tries to log in with non-existing account, a message is shown": function (
|
||||
client) {
|
||||
"existing user should be able to change their password" : function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignIn")
|
||||
.resizeWindow(1600, 1200)
|
||||
.verify.containsText("#usernameLink", "Sign In")
|
||||
.signIn("janicedoe@symptomatic.io", "janicedoe123").pause(500)
|
||||
.verify.containsText("#usernameLink", "janicedoe@symptomatic.io")
|
||||
.url("http://localhost:3000/changePassword")
|
||||
.verify.elementPresent("#changePasswordPageOldPasswordInput")
|
||||
.verify.elementPresent("#changePasswordPagePasswordInput")
|
||||
.verify.elementPresent("#changePasswordPagePasswordConfirmInput")
|
||||
.verify.elementPresent("#changePasswordButton")
|
||||
},
|
||||
"existing user should be notified if desired new password is insecure" : function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignIn")
|
||||
.resizeWindow(1600, 1200)
|
||||
.verify.containsText("#usernameLink", "Sign In")
|
||||
.signIn("janicedoe@symptomatic.io", "janicedoe123").pause(500)
|
||||
.verify.containsText("#usernameLink", "janicedoe@symptomatic.io")
|
||||
.url("http://localhost:3000/changePassword")
|
||||
.verify.elementPresent("#changePasswordPageOldPasswordInput")
|
||||
.verify.elementPresent("#changePasswordPagePasswordInput")
|
||||
.verify.elementPresent("#changePasswordPagePasswordConfirmInput")
|
||||
.verify.elementPresent("#changePasswordButton")
|
||||
.verify.cssProperty('#changePasswordPagePasswordInput', 'border', '1px solid gray')
|
||||
.setValue("#changePasswordPagePasswordInput", "jan")
|
||||
.verify.cssProperty('#changePasswordPagePasswordInput', 'border', '1px solid rgb(242, 222, 222)')
|
||||
.setValue("#changePasswordPagePasswordInput", "icedoe123")
|
||||
.verify.cssProperty('#changePasswordPagePasswordInput', 'border', '1px solid green')
|
||||
.verify.cssProperty('#changePasswordPagePasswordConfirmInput', 'border', '1px solid gray')
|
||||
.setValue("#changePasswordPagePasswordConfirmInput", "ja")
|
||||
.verify.cssProperty('#changePasswordPagePasswordConfirmInput', 'border', '1px solid rgb(242, 222, 222)')
|
||||
.clearValue("#changePasswordPagePasswordConfirmInput")
|
||||
.setValue("#changePasswordPagePasswordConfirmInput", "janicedoe123")
|
||||
.verify.cssProperty('#changePasswordPagePasswordConfirmInput', 'border', '1px solid green')
|
||||
},
|
||||
"if anonymous user tries to log in with non-existing account, a message is shown" : function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignIn")
|
||||
.resizeWindow(1024, 768)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user