WIP reorganization
This commit is contained in:
1 parent
6706dfe634
commit
054e37dfb7
266 files changed
+98
-620
No files matched your search
@@ -1,13 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
#sudo: required
|
||||
|
||||
sudo: required
|
||||
|
||||
env:
|
||||
global:
|
||||
- METEOR_ENV=development
|
||||
|
||||
before_install:
|
||||
- "curl -L http://git.io/ejPSng | /bin/sh"
|
||||
@@ -1,34 +0,0 @@
|
||||
## 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.
|
||||
- Next, clone the package into a project for local development.
|
||||
- Use ``git checkout -b newfeature`` to create a new branch.
|
||||
- Run the package verification tests to ensure that the test runner works.
|
||||
- Add an it() clause at the bottom of the [activeEntryTests.js](https://github.com/clinical-meteor/clinical-active-entry/blob/master/tests/gagarin/activeEntryTests.js) file for each new feature you wish to implement.
|
||||
- Sketch out a test script for a feature.
|
||||
- Run the verification tests, and confirm that the new test fails.
|
||||
- Update the package with the new feature until the new test passes.
|
||||
- Push the package to the repo on GitHub.
|
||||
- Submit a pull-request.
|
||||
- If the PR passes tests on Circle CI, we'll merge it in!
|
||||
|
||||
**Reference Implementation**
|
||||
- Please see the [ChecklistManifest](http://checklist-manifesto.meteor.com/) and it's [source code](https://github.com/clinical-meteor/checklist-manifesto) for a reference implementation of the ActiveEntry package. It's being built as a workqueue, and is being designed to be FDA, HIPAA, and HL7 FHIR compliant.
|
||||
|
||||
**Feature Toggling**
|
||||
- In general, it's a best practice to implement features that can be enabled/disabled. Some people will want a feature; others will not. The best way to toggle features is adding them to a config file, which is what the [ActiveEntry](https://github.com/clinical-meteor/clinical-active-entry/blob/master/lib/ActiveEntry.js) object is for.
|
||||
- It's recommended that fields be added to the ActiveEntryConfig object that can be used to enabled/disable the feature you are implementing.
|
||||
- The ActiveEntryConfig object can be roughly considered as analogous to the ``props`` field that is passed into React templates.
|
||||
|
||||
**Theming and Styling**
|
||||
- Different apps require different presentation/style layers, so Clinical Meteor has implemented a [Theme](https://github.com/clinical-meteor/clinical-theming/blob/master/objects/Theme.js) object which manages theming. Generally speaking, we're trying to avoid the inclusion of third-party component libraries, UI widgets, and CSS frameworks, and keeping the Clinical Meteor packages as close to the default HTML that Blaze produces as possible (while using line styles for animation effects).
|
||||
- Generally speaking, Bootstrap HTML structure in acceptable in designing pages, but avoid including global CSS files, and keep any CSS locally scoped using LESS nested classes. This approach allows people to add the Bootstrap library if they want it, prevents cascading leaks, and allows more fine-grained control over CSS to implement animation effects.
|
||||
- Pull requests that include visual integration with other projects are acceptable, but please submit an issue for discussion before submitting PRs with wholesale changes that include Jade, Material UI, React, etc.
|
||||
- The ActiveEntry pages are designed to be used in an IronRouter Layout template. As such, no height/width constraints are provided. It's assumed that the layout template will take care of such things. But basic padding/margin is provided.
|
||||
@@ -1,130 +0,0 @@
|
||||
## clinical:active-entry
|
||||
|
||||
This package provides the SignIn, SignUp, and ForgotPassword pages.
|
||||
|
||||
[](https://circleci.com/gh/clinical-meteor/active-entry/tree/master)
|
||||
|
||||
===============================
|
||||
#### Installation
|
||||
|
||||
````
|
||||
meteor add clinical:active-entry
|
||||
````
|
||||
|
||||
===============================
|
||||
#### Entry Flowchart
|
||||
|
||||
The following diagram represents the entry workflow that is being implemented in this package. This package is under active development, and is about half completed. Pull requests which help implement the following workflow will be fast-tracked and accepted into the package.
|
||||
|
||||

|
||||
|
||||
|
||||
|
||||
===============================
|
||||
#### Routing API
|
||||
|
||||
````
|
||||
/entrySignIn
|
||||
/entrySignUp
|
||||
/forgotPassword
|
||||
````
|
||||
|
||||
===============================
|
||||
#### Component API
|
||||
|
||||
````
|
||||
{{> entrySignIn }}
|
||||
{{> entrySignUp }}
|
||||
{{> forgotPassword }}
|
||||
````
|
||||
|
||||
|
||||
===============================
|
||||
#### ActiveEntry Configuration
|
||||
|
||||
````js
|
||||
|
||||
if(Meteor.isClient){
|
||||
ActiveEntry.configure({
|
||||
logo: {
|
||||
url: "/mini-circles.png",
|
||||
displayed: true
|
||||
},
|
||||
signIn: {
|
||||
displayFullName: true,
|
||||
destination: "/table/users"
|
||||
},
|
||||
signUp: {
|
||||
destination: "/table/users"
|
||||
},
|
||||
themeColors: {
|
||||
primary: ""
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(Meteor.isServer){
|
||||
Accounts.emailTemplates.siteName = "AwesomeSite";
|
||||
Accounts.emailTemplates.from = "AwesomeSite Admin <accounts@example.com>";
|
||||
Accounts.emailTemplates.enrollAccount.subject = function (user) {
|
||||
return "Welcome to Awesome Town, " + user.profile.name;
|
||||
};
|
||||
Accounts.emailTemplates.enrollAccount.text = function (user, url) {
|
||||
return "You have been selected to participate in building a better future!"
|
||||
+ " To activate your account, simply click the link below:\n\n"
|
||||
+ url;
|
||||
};
|
||||
|
||||
Meteor.startup(function(){
|
||||
process.env.MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword@smtp.mailgun.org:587';
|
||||
})
|
||||
}
|
||||
````
|
||||
Alternatively, you may want to set the ``MAIL_URL`` via an external environment variable, particularly if you're using a SaaS hosting provider.
|
||||
|
||||
````sh
|
||||
MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword@smtp.mailgun.org:587' meteor
|
||||
````
|
||||
|
||||
===============================
|
||||
#### Local Development
|
||||
|
||||
Simply clone the repository into your ``/packages`` directory. You can also specify the packages you want to develop locally in your ``.git-packages.json`` file, and use starrynight to fetch them.
|
||||
|
||||
````bash
|
||||
# clone a single package into your application
|
||||
git clone http://github.com/clinical-meteor/clinical-active-entry packages/active-entry
|
||||
|
||||
# fetch all the packages listed in git-packages.json
|
||||
starrynight fetch
|
||||
````
|
||||
|
||||
===============================
|
||||
#### Quality Assurance Testing
|
||||
|
||||
There are two types of quality assurance tests you can run: verification and validation tests. Verification tests are similar to unit or integration tests; and can run either at the application or package level. Validation tests are application-wide, but often require commands exposed in packages. So you'll need to run the ``autoconfig`` command to scan the filesystem for validation commands. See [http://starrynight.meteor.com/](http://starrynight.meteor.com/) for more details.
|
||||
|
||||
````bash
|
||||
# install the testing utility
|
||||
npm install -g starrynight
|
||||
|
||||
# verification testing (a.k.a. package-level unit/integration testing)
|
||||
starrynight run-tests --type package-verification
|
||||
|
||||
#to run validation tests, you'll need an ``.initializeUsers()`` function
|
||||
meteor add clinical:accounts-housemd
|
||||
|
||||
#validation testing (a.k.a. application acceptance/end-to-end testing)
|
||||
starrynight autoscan
|
||||
starrynight run-tests --type validation
|
||||
````
|
||||
|
||||
===============================
|
||||
#### Contributing
|
||||
|
||||
See our [notes on contributing](https://github.com/clinical-meteor/clinical-active-entry/blob/master/Contributing.md).
|
||||
|
||||
===============================
|
||||
#### Licensing
|
||||
|
||||

|
||||
@@ -1,84 +0,0 @@
|
||||
## Customize the test machine
|
||||
machine:
|
||||
node:
|
||||
version: 0.10.33
|
||||
|
||||
# Timezone
|
||||
timezone:
|
||||
America/Los_Angeles # Set the timezone
|
||||
|
||||
# Add some environment variables
|
||||
environment:
|
||||
CIRCLE_ENV: test
|
||||
CXX: g++-4.8
|
||||
DISPLAY: :99.0
|
||||
NPM_PREFIX: /home/ubuntu/nvm/v0.10.33
|
||||
|
||||
|
||||
## Customize checkout
|
||||
checkout:
|
||||
post:
|
||||
#- git submodule sync
|
||||
#- git submodule update --init --recursive # use submodules
|
||||
|
||||
#general:
|
||||
# build_dir: helloworld
|
||||
|
||||
## Customize dependencies
|
||||
dependencies:
|
||||
cache_directories:
|
||||
- ~/.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:
|
||||
- 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 30
|
||||
override:
|
||||
- cd ${HOME}/helloworld && starrynight run-tests --type package-verification
|
||||
|
||||
## Customize deployment commands
|
||||
#deployment:
|
||||
# production:
|
||||
# branch: master
|
||||
# commands:
|
||||
# - printf "<Meteor username>\n<Meteor password>\n" | meteor deploy circlecivelocity.meteor.com
|
||||
|
||||
## Custom notifications
|
||||
#notify:
|
||||
#webhooks:
|
||||
# A list of hashes representing hooks. Only the url field is supported.
|
||||
#- url: https://someurl.com/hooks/circle
|
||||
@@ -1,48 +0,0 @@
|
||||
<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>
|
||||
{{#if changePasswordErrorMessages}}
|
||||
<div id="errorMessages" class="list-errors">
|
||||
{{#each changePasswordErrorMessages}}
|
||||
<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>
|
||||
</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>
|
||||
@@ -1,100 +0,0 @@
|
||||
//==========================================
|
||||
|
||||
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";
|
||||
}
|
||||
},
|
||||
|
||||
changePasswordErrorMessages: function() {
|
||||
var allErrorMessages = Object.keys(ActiveEntry.errorMessages.all()).filter(function(key) {
|
||||
return (key === "password" || key === "confirm") && ActiveEntry.errorMessages.get(key);
|
||||
});
|
||||
|
||||
if (allErrorMessages.length > 0) {
|
||||
var errorMessage = ActiveEntry.errorMessages.get(allErrorMessages[0]);
|
||||
if (errorMessage) {
|
||||
return [errorMessage];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
||||
if (ActiveEntry.errorMessages.get('password') || ActiveEntry.errorMessages.get('confirm') || !oldPassword) {
|
||||
return;
|
||||
}
|
||||
|
||||
ActiveEntry.changePassword(oldPassword, password);
|
||||
|
||||
}
|
||||
});
|
||||
@@ -1,5 +0,0 @@
|
||||
#changePassword{
|
||||
input{
|
||||
padding-left: 40px;
|
||||
}
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
|
||||
/**
|
||||
* @summary Determines if a block of code should be displayed based on whether the logo is set to be displayed.
|
||||
* @locus Client
|
||||
* @memberOf Entry
|
||||
* @name {{logoIsDisplayed}}
|
||||
* @version 1.2.3
|
||||
* @returns {Boolean}
|
||||
* @example
|
||||
* ```html
|
||||
* {{#if logoIsDisplayed}}
|
||||
* <div class="entryLogo" style="background-image: url('{{logoUrl}}')"></div>
|
||||
* {{/if}}
|
||||
* ```
|
||||
*/
|
||||
Template.registerHelper("logoIsDisplayed", function (argument){
|
||||
var config = Session.get('Photonic.ActiveEntry');
|
||||
if(config && config.logo && config.logo.displayed){
|
||||
return config.logo.displayed;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @summary Retruns the Url of the logo asset.
|
||||
* @locus Client
|
||||
* @memberOf Entry
|
||||
* @name {{logoUrl}}
|
||||
* @version 1.2.3
|
||||
* @returns {String}
|
||||
* @example
|
||||
* ```html
|
||||
* {{#if logoIsDisplayed}}
|
||||
* <div class="entryLogo" style="background-image: url('{{logoUrl}}')"></div>
|
||||
* {{/if}}
|
||||
* ```
|
||||
*/
|
||||
Template.registerHelper("logoUrl", function (argument){
|
||||
var config = Session.get('Photonic.ActiveEntry');
|
||||
if(config && config.logo && config.logo.url){
|
||||
return config.logo.url;
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Template.registerHelper("getButtonColor", function (argument){
|
||||
return "background-color: " + Theme.getPaletteColor("colorB") + "; ";
|
||||
});
|
||||
@@ -1,169 +0,0 @@
|
||||
// @import 'client/app/stylesheets/util/reset.lessimport';
|
||||
// @import 'client/app/stylesheets/util/lesshat.lessimport';
|
||||
// @import 'client/app/stylesheets/util/typography.lessimport';
|
||||
|
||||
|
||||
// this probably wants to be moved into clinical:glass-ui
|
||||
.entryPage {
|
||||
input, button, select{
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
font-family: 'Open Sans', "Helvetica Neue", Helvetica, Arial, sans-serif;
|
||||
font-style: 400;
|
||||
padding: .75rem 0;
|
||||
line-height: 1.5rem !important;
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
box-sizing: border-box;
|
||||
//color: #333333;
|
||||
outline: none;
|
||||
padding-left: 3em;
|
||||
}
|
||||
}
|
||||
|
||||
.entryLogo{
|
||||
//background-color: lightgray;
|
||||
height: 200px;
|
||||
width: 200px;
|
||||
background-size: contain;
|
||||
background-repeat: no-repeat;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.btn-primary{
|
||||
background-color: forestgreen;
|
||||
color: #ffffff;
|
||||
}
|
||||
.btn-gray{
|
||||
background-color: #aaaaaa;
|
||||
color: white;
|
||||
}
|
||||
.btn-main{
|
||||
font-weight: 300;
|
||||
letter-spacing: 3px;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.input-symbol {
|
||||
display: inline-block;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.entryPage {
|
||||
text-align: center;
|
||||
|
||||
input, button{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.fa{
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
padding-left: 15px;
|
||||
padding-top: 14px;
|
||||
}
|
||||
|
||||
.checkmarkIcon{
|
||||
position: absolute;
|
||||
color: #831d2c;
|
||||
}
|
||||
.btn-gray{
|
||||
width: 100%;
|
||||
}
|
||||
.checkmarkTitle{
|
||||
padding-bottom: 100px;
|
||||
}
|
||||
.fa{
|
||||
position: absolute;
|
||||
left: 0px;
|
||||
top: 0px;
|
||||
padding-left: 15px;
|
||||
padding-top: 16px;
|
||||
// color: #555555;
|
||||
}
|
||||
|
||||
.wrapper-auth {
|
||||
//padding-top: 4em;
|
||||
|
||||
@media screen and (min-width: 40em) {
|
||||
margin: 0 auto;
|
||||
max-width: 480px;
|
||||
width: 80%;
|
||||
}
|
||||
@media screen and (max-width: 480px) {
|
||||
margin: 0 auto;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
// .input-symbol{
|
||||
// border: 1px solid gray;
|
||||
// }
|
||||
|
||||
.title-auth {
|
||||
color: black;
|
||||
margin-bottom: .75rem;
|
||||
}
|
||||
|
||||
.subtitle-auth {
|
||||
color: black;
|
||||
//margin: 0 15% 3rem;
|
||||
margin-bottom: 2rem;
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
form {
|
||||
input{
|
||||
color: #333333;
|
||||
height: 48px;
|
||||
border-left: solid 1px !important;
|
||||
}
|
||||
.input-symbol {
|
||||
margin-bottom: 1px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
//margin: 1em 5% 0;
|
||||
//width: 90%;
|
||||
margin-top: 1em;
|
||||
|
||||
@media screen and (min-width: 40em) {
|
||||
// margin-left: 0;
|
||||
// margin-right: 0;
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
}
|
||||
.list-errors {
|
||||
margin-top: -2rem;
|
||||
.taskItems {
|
||||
//.title-caps;
|
||||
background: white;
|
||||
color: red;
|
||||
font-size: .625em; // 10px
|
||||
margin-bottom: 1px;
|
||||
padding: .7rem 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.link-auth-alt {
|
||||
//.font-s1;
|
||||
//.position(absolute, auto, 0, 1em, 0);
|
||||
color: black;
|
||||
display: inline-block;
|
||||
|
||||
@media screen and (min-width: 40em) {
|
||||
bottom: 0;
|
||||
margin-top: 1rem;
|
||||
position: relative;
|
||||
}
|
||||
}
|
||||
|
||||
// @media only screen and (max-width: 704px) {
|
||||
// .fa{
|
||||
// left: 5%;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
|
||||
|
||||
exports.command = function () {
|
||||
this
|
||||
.execute(function () {
|
||||
return Meteor.logout();
|
||||
}).pause(1000);
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -1,23 +0,0 @@
|
||||
exports.command = function (email, password) {
|
||||
|
||||
this.verify.elementPresent("#entrySignIn");
|
||||
|
||||
if (email) {
|
||||
this
|
||||
.verify.elementPresent("#signInPageEmailInput")
|
||||
.clearValue("#signInPageEmailInput")
|
||||
.setValue("#signInPageEmailInput", email);
|
||||
}
|
||||
|
||||
|
||||
if (password) {
|
||||
this
|
||||
.verify.elementPresent("#signInPagePasswordInput")
|
||||
.clearValue("#signInPagePasswordInput")
|
||||
.setValue("#signInPagePasswordInput", password);
|
||||
}
|
||||
|
||||
this.click("#signInToAppButton").pause(1000);
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -1,22 +0,0 @@
|
||||
exports.command = function (fullname) {
|
||||
this
|
||||
.sectionBreak(".signOut()");
|
||||
|
||||
if (fullname) {
|
||||
this
|
||||
.verify.elementPresent("#usernameLink")
|
||||
.verify.containsText("#usernameLink", fullname);
|
||||
}
|
||||
|
||||
this
|
||||
.verify.elementPresent("#logoutLink")
|
||||
.click("#logoutLink").pause(1000);
|
||||
|
||||
if (fullname) {
|
||||
this
|
||||
.verify.elementPresent("#usernameLink")
|
||||
.verify.containsText("#usernameLink", "Sign In");
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -1,35 +0,0 @@
|
||||
exports.command = function (email, password, title, message) {
|
||||
this
|
||||
// .verify.element("#entrySignIn").to.be.visible
|
||||
// .verify.element("#signInPageTitle").to.be.visible
|
||||
// .verify.element("#signInPageMessage").to.be.visible
|
||||
// .verify.element("#signInPageEmailInput").to.be.visible
|
||||
// .verify.element("#signInPagePasswordInput").to.be.visible
|
||||
// .verify.element("#signInToAppButton").to.be.visible
|
||||
// .verify.element("#needAnAccountButton").to.be.visible
|
||||
//
|
||||
|
||||
.verify.elementPresent("#entrySignIn")
|
||||
.verify.elementPresent("#signInPageTitle")
|
||||
.verify.elementPresent("#signInPageMessage")
|
||||
.verify.elementPresent("#signInPageEmailInput")
|
||||
.verify.elementPresent("#signInPagePasswordInput")
|
||||
.verify.elementPresent("#signInToAppButton")
|
||||
.verify.elementPresent("#needAnAccountButton");
|
||||
|
||||
if (email) {
|
||||
this.verify.containsText("#signInPageEmailInput", email);
|
||||
}
|
||||
if (password) {
|
||||
this.verify.containsText("#signInPageEmailInput", password);
|
||||
}
|
||||
|
||||
if (title) {
|
||||
this.verify.containsText("#signInPageTitle", title);
|
||||
}
|
||||
if (message) {
|
||||
this.verify.containsText("#signInPageMessage", message);
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -1,73 +0,0 @@
|
||||
<template name="entrySignIn">
|
||||
<div id="entrySignIn" class="page entryPage" style="{{getOpacityWithCorner}}">
|
||||
|
||||
<div class="content-scrollable">
|
||||
<div class="wrapper-auth">
|
||||
{{#if logoIsDisplayed}}
|
||||
<div id="entryAppLogo" class="entryLogo" style="background-image: url('{{logoUrl}}')"></div>
|
||||
{{/if}}
|
||||
|
||||
{{#if isLoggedIn}}
|
||||
<h1 id="signInPageTitle" class="title-auth">{{fullName}}</h1>
|
||||
<div id="signInPageMessage" class="subtitle-auth">You are currently signed in.</div>
|
||||
|
||||
<button id="logoutButton" class="btn-primary btn-main btn-large" style="{{getButtonColor}}">Logout</button>
|
||||
{{else}}
|
||||
<h1 id="signInPageTitle" class="title-auth">Sign In.</h1>
|
||||
<p id="signInPageMessage" class="subtitle-auth" style="{{getSignInMessageColor}}">{{{getSignInMessage}}}</p>
|
||||
|
||||
{{#if isLDAPSet}}
|
||||
<form>
|
||||
{{#if ldapErrorMessages}}
|
||||
<div id="errorMessages" class="list-errors">
|
||||
{{#each ldapErrorMessages}}
|
||||
<div class="alert alert-danger list-item">{{this}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="input-symbol">
|
||||
<input id="signInLDAPUsernameInput" type="text" name="username" placeholder="Username" style="{{getLDAPUsernameValidationStyling}}" />
|
||||
<i class="fa fa-envelope-o" title="Your Email"></i>
|
||||
</div>
|
||||
<br><br>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="signInLDAPPasswordInput" type="password" name="password" placeholder="Password" style={{getLDAPPasswordValidationStyling}} />
|
||||
<span class="fa fa-lock" title="Password"></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<br><br>
|
||||
<button id="signInLDAPToAppButton" class="btn-primary btn-main btn-large" style="{{getButtonColor}}">{{getButtonText}}</button>
|
||||
{{else}}
|
||||
<form>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="signInPageEmailInput" type="text" name="email" placeholder="Your Email" style="{{getEmailValidationStyling}}" />
|
||||
<i class="fa fa-envelope-o" title="Your Email"></i>
|
||||
</div>
|
||||
<br><br>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="signInPagePasswordInput" type="password" name="password" placeholder="Password" style={{getPasswordValidationStyling}} />
|
||||
<span class="fa fa-lock" title="Password"></span>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<br><br>
|
||||
<button id="signInToAppButton" class="btn-primary btn-main btn-large disabledButton" disabled style="{{getButtonColor}}">{{getButtonText}}</button>
|
||||
|
||||
<br><br>
|
||||
<button id="needAnAccountButton" class="btn-gray btn-main btn-large">Need an account?</button>
|
||||
|
||||
<br><br>
|
||||
<button id="forgotPasswordButton" class="btn-gray btn-main btn-large">Forgot password?</button>
|
||||
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,205 +0,0 @@
|
||||
|
||||
// REFACTOR: Move to ActiveRecord object
|
||||
//Session.set("defaultSignInMessage", "Improve your clinical practice with checklists.");
|
||||
|
||||
//==================================================================================================
|
||||
// ROUTER
|
||||
|
||||
Router.route('/entrySignIn', {
|
||||
template: 'entrySignIn',
|
||||
name: 'entrySignIn'
|
||||
});
|
||||
Router.route('/sign-in', {
|
||||
template: 'entrySignIn',
|
||||
name: 'signInRoute'
|
||||
});
|
||||
|
||||
//==================================================================================================
|
||||
// COMPONENT OUTPUTS
|
||||
|
||||
|
||||
|
||||
|
||||
Template.entrySignIn.helpers({
|
||||
getSignInMessageColor: function (){
|
||||
if (ActiveEntry.errorMessages.get('signInError')) {
|
||||
return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;"
|
||||
} else {
|
||||
return "color: black;"
|
||||
}
|
||||
},
|
||||
getSignInMessage: function (){
|
||||
if (ActiveEntry.errorMessages.get('signInError')) {
|
||||
return ActiveEntry.errorMessages.get('signInError');
|
||||
} else {
|
||||
return Session.get('defaultSignInMessage');
|
||||
}
|
||||
},
|
||||
getButtonText: function () {
|
||||
return "Sign In";
|
||||
// if (ActiveEntry.errorMessages.get('signInError')){
|
||||
// return ActiveEntry.errorMessages.get('signInError');
|
||||
// } else {
|
||||
// return "Sign In";
|
||||
// }
|
||||
},
|
||||
getEmailValidationStyling: function () {
|
||||
if (ActiveEntry.errorMessages.equals('email', "Email is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('email', "Email is poorly formatted")) {
|
||||
return "border: 1px solid #f2dede";
|
||||
} else if (ActiveEntry.successMessages.equals('email', "Email present")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
},
|
||||
getPasswordValidationStyling: function () {
|
||||
if (ActiveEntry.errorMessages.equals('password', "Password is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('password', Session.get('passwordWarning'))) {
|
||||
return "border: 1px solid #f2dede";
|
||||
} else if (ActiveEntry.successMessages.equals('password', "Password present")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
},
|
||||
|
||||
getLDAPUsernameValidationStyling: function() {
|
||||
if (ActiveEntry.errorMessages.equals('ldapUsername', "Username is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.successMessages.equals('ldapUsername', "Username present")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
},
|
||||
getLDAPPasswordValidationStyling: function() {
|
||||
if (ActiveEntry.errorMessages.equals('ldapPassword', "Password is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.successMessages.equals('ldapPassword', "Password present")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
},
|
||||
isLDAPSet: function() {
|
||||
return Session.get('isLDAPSet');
|
||||
},
|
||||
ldapErrorMessages: function () {
|
||||
if (ActiveEntry.errorMessages.get("ldapUsername")) {
|
||||
return [ActiveEntry.errorMessages.get("ldapUsername")];
|
||||
} else if(ActiveEntry.errorMessages.get("ldapPassword")) {
|
||||
return [ActiveEntry.errorMessages.get("ldapPassword")];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//==================================================================================================
|
||||
// COMPONENT OUTPUTS
|
||||
|
||||
Template.entrySignIn.events({
|
||||
'click #logoutButton': function () {
|
||||
Meteor.logout();
|
||||
},
|
||||
'click #forgotPasswordButton': function (event) {
|
||||
event.preventDefault();
|
||||
ActiveEntry.reset();
|
||||
Router.go('/forgotPassword');
|
||||
},
|
||||
"click #needAnAccountButton": function (event) {
|
||||
event.preventDefault();
|
||||
ActiveEntry.reset();
|
||||
Router.go('/entrySignUp');
|
||||
},
|
||||
'keyup input[name="email"]': function (event, template) {
|
||||
var email = $('input[name="email"]').val();
|
||||
|
||||
ActiveEntry.verifyEmail(email);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
setSignInButtonStyling();
|
||||
},
|
||||
'change input[name="email"]': function (event, template) {
|
||||
var email = $('input[name="email"]').val();
|
||||
|
||||
ActiveEntry.verifyEmail(email);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
setSignInButtonStyling();
|
||||
},
|
||||
'keyup #signInPagePasswordInput': function (event, template) {
|
||||
var password = $('input[name="password"]').val();
|
||||
|
||||
ActiveEntry.verifyPassword(password);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
setSignInButtonStyling();
|
||||
},
|
||||
'change #signInPagePasswordInput': function (event, template) {
|
||||
var password = $('input[name="password"]').val();
|
||||
|
||||
ActiveEntry.verifyPassword(password);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
setSignInButtonStyling();
|
||||
},
|
||||
'keyup, change #signInLDAPUsernameInput': function (event, template) {
|
||||
var username = $('#signInLDAPUsernameInput').val();
|
||||
ActiveEntry.verifyLDAPUsername(username);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
},
|
||||
'keyup, change #signInLDAPPasswordInput': function (event, template) {
|
||||
var password = $('#signInLDAPPasswordInput').val();
|
||||
ActiveEntry.verifyLDAPPassword(password);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
},
|
||||
// 'submit': function (event, template) {
|
||||
// event.preventDefault();
|
||||
// var emailValue = template.$('[name=email]').val();
|
||||
// var passwordValue = template.$('[name=password]').val();
|
||||
//
|
||||
// ActiveEntry.signIn(emailValue, passwordValue);
|
||||
// },
|
||||
'click #signInToAppButton': function (event, template){
|
||||
ActiveEntry.reset();
|
||||
// var emailValue = template.$('[name=email]').val();
|
||||
// var passwordValue = template.$('[name=password]').val();
|
||||
var emailValue = template.$('#signInPageEmailInput').val();
|
||||
var passwordValue = template.$('#signInPagePasswordInput').val();
|
||||
|
||||
ActiveEntry.signIn(emailValue, passwordValue);
|
||||
event.preventDefault();
|
||||
},
|
||||
'keyup #entrySignIn': function(event, template) {
|
||||
if(event.keyCode == 13) {
|
||||
$("#signInToAppButton").click();
|
||||
$("#signInLDAPToAppButton").click();
|
||||
|
||||
}
|
||||
},
|
||||
'click #signInLDAPToAppButton': function(e, template) {
|
||||
var username = template.$("#signInLDAPUsernameInput").val();
|
||||
var password = template.$("#signInLDAPPasswordInput").val();
|
||||
ActiveEntry.loginWithLDAP(username, password);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
// Sets SignInButton Styling according to email and password fields
|
||||
function setSignInButtonStyling() {
|
||||
var signInToAppButton = $("#signInToAppButton");
|
||||
if ($("#signInPagePasswordInput").val() && ActiveEntry.successMessages.get('email')) {
|
||||
// Set button as enable
|
||||
signInToAppButton.removeClass("disabledButton");
|
||||
signInToAppButton.attr("disabled", false);
|
||||
} else {
|
||||
signInToAppButton.addClass("disabledButton");
|
||||
signInToAppButton.attr("disabled", true);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
#entrySignIn{
|
||||
padding: 40px;
|
||||
input{
|
||||
padding-left: 40px;
|
||||
color: #333333 !important;
|
||||
}
|
||||
#errorMessages{
|
||||
padding-top: .5rem;
|
||||
padding-bottom: .5rem;
|
||||
font-size: 14px;
|
||||
box-sizing: border-box;
|
||||
width: 100.5%;
|
||||
margin-bottom: 15px;
|
||||
color: red;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.disabledButton {
|
||||
border: none;
|
||||
background-image: none;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
|
||||
filter: alpha(opacity=40);
|
||||
-khtml-opacity: 0.40;
|
||||
-moz-opacity: 0.40;
|
||||
opacity: 0.40;
|
||||
cursor: not-allowed;
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
// async version calls method on the server
|
||||
exports.command = function () {
|
||||
var client = this;
|
||||
|
||||
this
|
||||
.timeoutsAsyncScript(5000)
|
||||
.executeAsync(function (data, meteorCallback) {
|
||||
//return HipaaLogger.logEventObject(data);
|
||||
Meteor.call("dropEntryUsers", data, function (meteorError, meteorResult) {
|
||||
var response = (meteorError ? {
|
||||
error: meteorError
|
||||
} : {
|
||||
result: meteorResult
|
||||
});
|
||||
meteorCallback(response);
|
||||
});
|
||||
}, [], function (result) {
|
||||
//console.log("result.value", result.value);
|
||||
//client.assert.ok(result.value);
|
||||
}).pause(1000);
|
||||
return this;
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
|
||||
// resetEntry.js
|
||||
exports.command = function () {
|
||||
|
||||
this
|
||||
.timeoutsAsyncScript(5000)
|
||||
.executeAsync(function (data, meteorCallback) {
|
||||
ActiveEntry.reset();
|
||||
}, []).pause(1000);
|
||||
return this;
|
||||
};
|
||||
@@ -1,37 +0,0 @@
|
||||
exports.command = function (email, password, fullName) {
|
||||
|
||||
this.verify.elementPresent("#entrySignUp");
|
||||
|
||||
if (email) {
|
||||
this
|
||||
.verify.elementPresent("#signUpPageEmailInput")
|
||||
.clearValue("#signUpPageEmailInput")
|
||||
.setValue("#signUpPageEmailInput", email);
|
||||
}
|
||||
|
||||
|
||||
if (password) {
|
||||
this
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.clearValue("#signUpPagePasswordInput")
|
||||
.setValue("#signUpPagePasswordInput", password)
|
||||
|
||||
.verify.elementPresent("#signUpPagePasswordConfirmInput")
|
||||
.clearValue("#signUpPagePasswordConfirmInput")
|
||||
.setValue("#signUpPagePasswordConfirmInput", password);
|
||||
}
|
||||
|
||||
|
||||
if (fullName) {
|
||||
this
|
||||
.verify.elementPresent("#signUpPageFullNameInput")
|
||||
.clearValue("#signUpPageFullNameInput")
|
||||
.setValue("#signUpPageFullNameInput", fullName);
|
||||
}
|
||||
|
||||
|
||||
this.click("#signUpPageJoinNowButton").pause(300);
|
||||
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -1,31 +0,0 @@
|
||||
exports.command = function (email, password, fullName, message) {
|
||||
this
|
||||
.verify.elementPresent("#entrySignUp")
|
||||
.verify.elementPresent("#signUpPageTitle")
|
||||
.verify.elementPresent("#signUpPageMessage")
|
||||
.verify.elementPresent("#signUpPageFullNameInput")
|
||||
.verify.elementPresent("#signUpPageEmailInput")
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.verify.elementPresent("#signUpPagePasswordConfirmInput")
|
||||
|
||||
.verify.elementPresent("#signUpPageJoinNowButton")
|
||||
.verify.elementPresent("#signUpPageSignInButton");
|
||||
|
||||
if (email) {
|
||||
this.verify.containsText("#signUpPageEmailInput", email);
|
||||
}
|
||||
if (password) {
|
||||
this.verify.containsText("#signUpPagePasswordInput", password)
|
||||
.verify.containsText("#signUpPagePasswordConfirmInput", password);
|
||||
}
|
||||
if (fullName) {
|
||||
this.verify.containsText("#signUpPageFullNameInput", fullName);
|
||||
}
|
||||
if (message) {
|
||||
this.verify.elementPresent("#errorMessages")
|
||||
.verify.containsText("#errorMessages", message);
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -1,64 +0,0 @@
|
||||
<template name="entrySignUp">
|
||||
<div id="entrySignUp" class="page entryPage" style="{{getOpacityWithCorner}}">
|
||||
|
||||
<div class="content-scrollable">
|
||||
<div class="wrapper-auth">
|
||||
{{#if logoIsDisplayed}}
|
||||
<div id="entryAppLogo" class="entryLogo" style="background-image: url('{{logoUrl}}')"></div>
|
||||
{{/if}}
|
||||
|
||||
<h1 id="signUpPageTitle" class="title-auth">Join.</h1>
|
||||
<div id="signUpPageMessage" class="subtitle-auth" style="{{getSignUpMessageColor}}">{{getSignUpMessage}}</div>
|
||||
|
||||
<form id="entrySignUpForm">
|
||||
|
||||
{{#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="signUpPageFullNameInput" type="text" name="fullName" placeholder="Full Name" style="{{getFullNameStyling}}" />
|
||||
<i class="fa fa-user" title="Full Name"></i>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="signUpPageEmailInput" type="email" name="email" placeholder="Email Address" style="{{getEmailStyling}}" />
|
||||
<i class="fa fa-envelope-o" title="Your Email"></i>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="input-symbol ">
|
||||
<input id="signUpPagePasswordInput" type="password" name="password" placeholder="Password" style="{{getPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Password"></span>
|
||||
<!-- <span class="icon-lock" title="Password"></span> -->
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="signUpPagePasswordConfirmInput" type="password" name="confirm" placeholder="Confirm Password" style="{{getConfirmPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Confirm Password"></span>
|
||||
<!-- <span class="icon-lock" title="Confirm Password"></span> -->
|
||||
</div>
|
||||
</form>
|
||||
<br>
|
||||
<br>
|
||||
<button id="signUpPageJoinNowButton" type="submit" class="btn-primary btn-main btn-large" style="{{getButtonColor}}">Join Now</button>
|
||||
|
||||
<br>
|
||||
<br>
|
||||
<button id="signUpPageSignInButton" class="btn-gray btn-main btn-large">Have an account? Sign in</button>
|
||||
|
||||
</div>
|
||||
|
||||
<!-- <a id="signUpPageSignInButton" href="{{pathFor 'entrySignIn'}}" class="link-auth-alt">Have an account? Sign in</a> -->
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,171 +0,0 @@
|
||||
//==================================================================================================
|
||||
// ROUTER
|
||||
|
||||
Router.route('/entrySignUp', {
|
||||
template: 'entrySignUp',
|
||||
name: 'entrySignUp'
|
||||
});
|
||||
Router.route('/sign-up', {
|
||||
template: 'entrySignUp',
|
||||
name: 'signUpRoute'
|
||||
});
|
||||
|
||||
//==================================================================================================
|
||||
|
||||
|
||||
|
||||
Template.entrySignUp.helpers({
|
||||
getSignUpMessageColor: function (){
|
||||
if (ActiveEntry.errorMessages.get('signInError')) {
|
||||
return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;";
|
||||
} else {
|
||||
return "color: black;";
|
||||
}
|
||||
},
|
||||
getSignUpMessage: function (){
|
||||
if (ActiveEntry.errorMessages.get('signInError')) {
|
||||
return ActiveEntry.errorMessages.get('signInError');
|
||||
} else {
|
||||
return Session.get('defaultSignInMessage');
|
||||
}
|
||||
},
|
||||
entryErrorMessages: function () {
|
||||
var allErrorMessages = Object.keys(ActiveEntry.errorMessages.all()).filter(function(key) {
|
||||
return key !== "signInError" && ActiveEntry.errorMessages.get(key);
|
||||
});
|
||||
|
||||
if (allErrorMessages.length > 0) {
|
||||
var errorMessage = ActiveEntry.errorMessages.get(allErrorMessages[0]);
|
||||
if (errorMessage) {
|
||||
return [errorMessage];
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
},
|
||||
getButtonText: function () {
|
||||
if (ActiveEntry.errorMessages.get('signInError')) {
|
||||
return ActiveEntry.errorMessages.get('signInError').message;
|
||||
} else {
|
||||
return "Sign In";
|
||||
}
|
||||
},
|
||||
getEmailStyling: function () {
|
||||
if (ActiveEntry.errorMessages.equals('email', "Email is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('email', "Email is poorly formatted")) {
|
||||
return "border: 1px solid #f2dede";
|
||||
} else if (ActiveEntry.successMessages.equals('email', "Email present")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
},
|
||||
getPasswordStyling: function () {
|
||||
if (ActiveEntry.errorMessages.equals('password', "Password is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('password', Session.get('passwordWarning'))) {
|
||||
return "border: 1px solid #f2dede";
|
||||
} else if (ActiveEntry.successMessages.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.successMessages.equals('confirm', "Passwords match")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
},
|
||||
getFullNameStyling: function () {
|
||||
if (ActiveEntry.errorMessages.equals('fullName', "Name is required")) {
|
||||
return "border: 1px solid #a94442";
|
||||
} else if (ActiveEntry.errorMessages.equals('fullName', "Name is probably not complete")) {
|
||||
return "border: 1px solid #f2dede";
|
||||
} else if (ActiveEntry.successMessages.equals('fullName', "Name present")) {
|
||||
return "border: 1px solid green";
|
||||
} else {
|
||||
return "border: 1px solid gray";
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.entrySignUp.events({
|
||||
"click #signUpPageSignInButton": function (event) {
|
||||
event.preventDefault();
|
||||
ActiveEntry.reset();
|
||||
Router.go('/entrySignIn');
|
||||
},
|
||||
'change, keyup #signUpPageEmailInput': function (event, template) {
|
||||
var email = $('[name="email"]').val();
|
||||
|
||||
ActiveEntry.verifyEmail(email);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
},
|
||||
'change, keyup #signUpPagePasswordInput': function (event, template) {
|
||||
var password = $('[name="password"]').val();
|
||||
|
||||
ActiveEntry.verifyPassword(password);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
},
|
||||
'change, keyup #signUpPagePasswordConfirmInput': function (event, template) {
|
||||
|
||||
var password = $('[name="password"]').val();
|
||||
var confirmPassword = $('[name="confirm"]').val();
|
||||
// var password = $('#signUpPagePasswordInput').val();
|
||||
// var confirmPassword = $('#signUpPagePasswordConfirmInput').val();
|
||||
|
||||
ActiveEntry.verifyConfirmPassword(password, confirmPassword);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
},
|
||||
'change, keyup #signUpPageFullNameInput': function (event, template) {
|
||||
var fullName = template.$('[name="fullName"]').val();
|
||||
|
||||
ActiveEntry.verifyFullName(fullName);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
},
|
||||
'click #signUpPageJoinNowButton': function (event, template) {
|
||||
ActiveEntry.signUp(
|
||||
$('#signUpPageEmailInput').val(),
|
||||
$('#signUpPagePasswordInput').val(),
|
||||
$('#signUpPagePasswordConfirmInput').val(),
|
||||
$('#signUpPageFullNameInput').val()
|
||||
);
|
||||
},
|
||||
'keyup #entrySignUp': function(event, template) {
|
||||
if(event.keyCode == 13) {
|
||||
ActiveEntry.verifyFullName($("#signUpPageFullNameInput").val());
|
||||
ActiveEntry.verifyEmail($("#signUpPageEmailInput").val());
|
||||
ActiveEntry.verifyPassword($("#signUpPagePasswordInput").val());
|
||||
ActiveEntry.verifyConfirmPassword($("#signUpPagePasswordInput").val(), $("#signUpPagePasswordConfirmInput").val());
|
||||
|
||||
if (!ActiveEntry.errorMessages.get('signInError') &&
|
||||
ActiveEntry.successMessages.get('fullName') &&
|
||||
ActiveEntry.successMessages.get('email') &&
|
||||
ActiveEntry.successMessages.get('password') &&
|
||||
ActiveEntry.successMessages.get('confirm')) {
|
||||
$("#signUpPageJoinNowButton").click();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Template.entrySignUp.onRendered(function() {
|
||||
// Password strength meter for password inputs
|
||||
if (passwordValidationSettings.showPasswordStrengthIndicator) {
|
||||
this.$('#signUpPagePasswordInput').pwstrength(passwordValidationSettings.pwstrengthOptions);
|
||||
}
|
||||
|
||||
// Update password warning message if zxcvbn is active and zxcvbn function is defined
|
||||
if(passwordValidationSettings.requireStrongPasswords) {
|
||||
Session.set('passwordWarning', 'Password is weak');
|
||||
}
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
#entrySignUp{
|
||||
padding: 40px;
|
||||
input{
|
||||
padding-left: 40px !important;
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
|
||||
#entrySignUp .progress{
|
||||
height: 5px;
|
||||
margin-bottom: 1px
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
exports.command = function () {
|
||||
this
|
||||
.verify.elementPresent("#forgotPassword"); return this;
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
<template name="forgotPassword">
|
||||
<div id="forgotPassword" class="page entryPage" style="{{getOpacityWithCorner}}">
|
||||
<div class="content-scrollable">
|
||||
<div class="wrapper-auth">
|
||||
<div class="entryLogo" style="background-image: url('{{getLogoUrl}}')"></div>
|
||||
|
||||
<h1 id="signInPageTitle" class="title-auth">Forgot Password</h1>
|
||||
<div id="signInPageMessage" class="subtitle-auth" >Improve your clinical practice with checklists.</div>
|
||||
<p id="signInPageMessage" class="subtitle-auth" style="{{getForgotPasswordMessageColor}}">{{{getForgotPasswordMessage}}}</p>
|
||||
|
||||
<form>
|
||||
<div class="input-symbol">
|
||||
<input id="signInPageEmailInput" type="email" name="email" placeholder="Your Email" style="{{getForgotPasswordStyle}}" />
|
||||
<i class="fa fa-envelope-o" title="Your Email"></i>
|
||||
</div>
|
||||
<br><br>
|
||||
|
||||
<button id="sendReminderButton" type="submit" class="btn-gray btn-main btn-large" style="{{getButtonColor}}">Send Reminder</button><br><br>
|
||||
{{#if forgotPasswordNotification}}
|
||||
<div class="alert alert-success">
|
||||
{{{forgotPasswordNotification}}}
|
||||
</div>
|
||||
{{/if}}
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,36 +0,0 @@
|
||||
//==========================================
|
||||
|
||||
Router.route('/forgotPassword', {
|
||||
name: "forgotPassword",
|
||||
template: "forgotPassword"
|
||||
});
|
||||
|
||||
Template.forgotPassword.helpers({
|
||||
getForgotPasswordMessageColor: function (){
|
||||
if (ActiveEntry.errorMessages.get('forgotPassword')) {
|
||||
return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;"
|
||||
} else {
|
||||
return "color: black;"
|
||||
}
|
||||
},
|
||||
getForgotPasswordMessage: function (){
|
||||
return ActiveEntry.errorMessages.get('forgotPassword');
|
||||
},
|
||||
getForgotPasswordStyle: function (){
|
||||
return "border: 1px solid gray";
|
||||
},
|
||||
forgotPasswordNotification: function() {
|
||||
return ActiveEntry.successMessages.get("forgotPassword");
|
||||
}
|
||||
});
|
||||
|
||||
Template.forgotPassword.events({
|
||||
"submit": function (event, template) {
|
||||
event.preventDefault();
|
||||
console.log('send reminder!');
|
||||
ActiveEntry.successMessages.set("forgotPassword", "Your password reset email is sending...");
|
||||
var emailAddress = $('#signInPageEmailInput').val();
|
||||
ActiveEntry.forgotPassword(emailAddress);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
#forgotPassword{
|
||||
input{
|
||||
padding-left: 40px;
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
|
||||
<template name="resetPassword">
|
||||
{{#if resetPassword}}
|
||||
<div id="resetPassword" class="page entryPage" style="{{getOpacityWithCorner}}">
|
||||
<div class="content-scrollable">
|
||||
<div class="wrapper-auth">
|
||||
<div class="entryLogo" style="background-image: url('{{getLogoUrl}}')"></div>
|
||||
|
||||
<h1 id="signInPageTitle" class="title-auth">Reset Password</h1>
|
||||
<p id="signInPageMessage" class="subtitle-auth" style="{{getResetPasswordInMessageColor}}">{{{getResetPasswordMessage}}}</p>
|
||||
|
||||
<form>
|
||||
{{#if resetPasswordErrorMessages}}
|
||||
<div id="errorMessages" class="list-errors">
|
||||
{{#each resetPasswordErrorMessages}}
|
||||
<div class="alert alert-danger list-item">{{this}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/if}}
|
||||
<div class="input-symbol ">
|
||||
<input id="resetPasswordInput" type="password" name="password" placeholder="Password" style="{{getPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Password"></span>
|
||||
<!-- <span class="icon-lock" title="Password"></span> -->
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
<div class="input-symbol">
|
||||
<input id="resetPasswordConfirmInput" type="password" name="confirm" placeholder="Confirm Password" style="{{getConfirmPasswordStyling}}" />
|
||||
<span class="fa fa-lock" title="Confirm Password"></span>
|
||||
<!-- <span class="icon-lock" title="Confirm Password"></span> -->
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
</form>
|
||||
<button id="resetPasswordButton" type="submit" class="btn-gray btn-main btn-large" style="{{getButtonColor}}">Reset Password</button><br><br>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
</template>
|
||||
@@ -1,67 +0,0 @@
|
||||
|
||||
Router.route('/resetPassword/:token', {
|
||||
template: 'resetPassword',
|
||||
name: 'resetPassword',
|
||||
onBeforeAction: function() {
|
||||
var token = this.params.token;
|
||||
Session.set('_resetPasswordToken', token);
|
||||
this.next();
|
||||
}
|
||||
});
|
||||
|
||||
// Reset password template
|
||||
Template.resetPassword.helpers({
|
||||
getResetPasswordInMessageColor: function (){
|
||||
if (ActiveEntry.errorMessages.get('resetPasswordError')) {
|
||||
return "color: #a94442; background-color: #f2dede; border-color: #ebccd1;"
|
||||
} else {
|
||||
return "color: black;"
|
||||
}
|
||||
},
|
||||
getResetPasswordMessage: function (){
|
||||
if (ActiveEntry.errorMessages.get('resetPasswordError')) {
|
||||
return ActiveEntry.errorMessages.get('resetPasswordError');
|
||||
} else {
|
||||
return Session.get('defaultSignInMessage');
|
||||
}
|
||||
},
|
||||
resetPassword: function(){
|
||||
return Session.get('_resetPasswordToken');
|
||||
},
|
||||
resetPasswordErrorMessages: function() {
|
||||
if (ActiveEntry.errorMessages.get("password")) {
|
||||
return [ActiveEntry.errorMessages.get("password")];
|
||||
}
|
||||
if (ActiveEntry.errorMessages.get("confirm")) {
|
||||
return [ActiveEntry.errorMessages.get("confirm")];
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
Template.resetPassword.events({
|
||||
'keyup #resetPasswordInput': function (event, template) {
|
||||
var password = $('#resetPasswordInput').val();
|
||||
ActiveEntry.verifyPassword(password);
|
||||
ActiveEntry.errorMessages.set('resetPasswordError', null);
|
||||
},
|
||||
'keyup #resetPasswordConfirmInput': function (event, template) {
|
||||
|
||||
var password = $('#resetPasswordInput').val();
|
||||
var confirmPassword = $('#resetPasswordConfirmInput').val();
|
||||
|
||||
ActiveEntry.verifyConfirmPassword(password, confirmPassword);
|
||||
ActiveEntry.errorMessages.set('resetPasswordError', null);
|
||||
},
|
||||
'click #resetPasswordButton': function(e, template) {
|
||||
e.preventDefault();
|
||||
var password = $('#resetPasswordInput').val();
|
||||
var passwordConfirm = $('#resetPasswordConfirmInput').val();
|
||||
|
||||
if (ActiveEntry.errorMessages.get('password') || ActiveEntry.errorMessages.get('confirm')) {
|
||||
return;
|
||||
}
|
||||
ActiveEntry.resetPassword(password, passwordConfirm);
|
||||
}
|
||||
});
|
||||
@@ -1,48 +0,0 @@
|
||||
|
||||
|
||||
if (Meteor.isClient) {
|
||||
|
||||
|
||||
Accounts.onResetPasswordLink(function (token, done){
|
||||
console.log('Accounts.onResearchPasswordLink');
|
||||
console.log('Sending reset password email...');
|
||||
console.log('NOT IMPLEMENTED YET. PLEASE LOG AN ISSUE');
|
||||
console.log('token: ' + token);
|
||||
done();
|
||||
});
|
||||
|
||||
|
||||
Accounts.onEnrollmentLink(function (token, done){
|
||||
console.log('Accounts.onResearchPasswordLink');
|
||||
console.log('Sending enrollment email...');
|
||||
console.log('NOT IMPLEMENTED YET. PLEASE LOG AN ISSUE');
|
||||
console.log('token: ' + token);
|
||||
done();
|
||||
});
|
||||
|
||||
Accounts.onEmailVerificationLink(function (token, done){
|
||||
console.log('Accounts.onEmailVerificationLink');
|
||||
console.log('Sending verification email...');
|
||||
console.log('NOT IMPLEMENTED YET. PLEASE LOG AN ISSUE');
|
||||
console.log('token: ' + token);
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if (Meteor.isServer){
|
||||
// Support for playing D&D: Roll 3d6 for dexterity
|
||||
Accounts.onCreateUser(function(options, user) {
|
||||
|
||||
var d6 = function () { return Math.floor(Random.fraction() * 6) + 1; };
|
||||
user.dexterity = d6() + d6() + d6();
|
||||
user.role = "user";
|
||||
|
||||
// We still want the default hook's 'profile' behavior.
|
||||
if (options.profile){
|
||||
user.profile = options.profile;
|
||||
}
|
||||
|
||||
return user;
|
||||
});
|
||||
}
|
||||
@@ -1,545 +0,0 @@
|
||||
|
||||
|
||||
ActiveEntry = {};
|
||||
ActiveEntry.isAbc = function () {
|
||||
return "abc";
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (Meteor.isClient) {
|
||||
Session.setDefault('Photonic.ActiveEntry', {
|
||||
logo: {
|
||||
url: "https://upload.wikimedia.org/wikipedia/commons/1/1a/Photon-photon_scattering.png",
|
||||
displayed: true
|
||||
},
|
||||
signIn: {
|
||||
displayFullName: true,
|
||||
destination: "/"
|
||||
},
|
||||
signUp: {
|
||||
destination: "/"
|
||||
},
|
||||
themeColors: {
|
||||
primary: ""
|
||||
},
|
||||
passwordOptions: {
|
||||
showPasswordStrengthIndicator: true,
|
||||
requireRegexValidation: true,
|
||||
//requireStrongPasswords: false
|
||||
passwordHistoryCount: 6,
|
||||
failedAttemptsLimit: 5,
|
||||
passwordExpirationDays: 90,
|
||||
inactivityPeriodDays: 180,
|
||||
expireTimeInMinute: 30
|
||||
}
|
||||
});
|
||||
|
||||
ActiveEntry.errorMessages = new ReactiveDict('errorMessages');
|
||||
ActiveEntry.errorMessages.set('signInError', false);
|
||||
|
||||
// Success messages
|
||||
ActiveEntry.successMessages = new ReactiveDict('successMessages');
|
||||
|
||||
// Change password warning message according to whether zxcvbn is turned on
|
||||
Session.set('passwordWarning', 'Password must have at least 8 characters. It must contain at least 1 uppercase, 1 lowercase, 1 number and 1 special character.');
|
||||
|
||||
// Activate LDAP if ldap url and port is set in settings.json
|
||||
Meteor.call('isLDAPSet', function(error, isSet) {
|
||||
Session.set('isLDAPSet', isSet);
|
||||
});
|
||||
}
|
||||
|
||||
if (Meteor.isServer) {
|
||||
LDAP_DEFAULTS = {};
|
||||
LDAP_DEFAULTS.url = Meteor.settings.ldap && Meteor.settings.ldap.url;
|
||||
LDAP_DEFAULTS.port = Meteor.settings.ldap && Meteor.settings.ldap.port;
|
||||
}
|
||||
|
||||
ActiveEntry.configure = function (configObject) {
|
||||
if (Meteor.isClient) {
|
||||
|
||||
// Set passwordOptions if they are not defined
|
||||
if (!configObject.passwordOptions) {
|
||||
configObject.passwordOptions = {
|
||||
showPasswordStrengthIndicator: true,
|
||||
requireRegexValidation: false,
|
||||
//requireStrongPasswords: false
|
||||
passwordHistoryCount: 6,
|
||||
failedAttemptsLimit: 5,
|
||||
passwordExpirationDays: 90,
|
||||
inactivityPeriodDays: 180,
|
||||
expireTimeInMinute: 30
|
||||
}
|
||||
}
|
||||
Session.set('Photonic.ActiveEntry', configObject);
|
||||
}
|
||||
};
|
||||
|
||||
ActiveEntry.verifyPassword = function (password) {
|
||||
if (password.length === 0) {
|
||||
ActiveEntry.errorMessages.set('password', 'Password is required');
|
||||
ActiveEntry.successMessages.set('password', null);
|
||||
} else if (!checkPasswordStrength(password)) {
|
||||
ActiveEntry.errorMessages.set('password', Session.get('passwordWarning'));
|
||||
ActiveEntry.successMessages.set('password', null);
|
||||
} else {
|
||||
ActiveEntry.errorMessages.set('password', null);
|
||||
ActiveEntry.successMessages.set('password', 'Password present');
|
||||
}
|
||||
};
|
||||
|
||||
ActiveEntry.verifyConfirmPassword = function (password, confirmPassword) {
|
||||
// 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 {
|
||||
ActiveEntry.errorMessages.set('confirm', 'Passwords do not match');
|
||||
ActiveEntry.successMessages.set('confirm', null);
|
||||
}
|
||||
};
|
||||
|
||||
ActiveEntry.verifyEmail = function (email) {
|
||||
if (email.length === 0) {
|
||||
ActiveEntry.errorMessages.set('email', 'Email is required');
|
||||
ActiveEntry.successMessages.set('email', null);
|
||||
} else if (email.indexOf("@") === -1){
|
||||
ActiveEntry.errorMessages.set('email', 'Email is poorly formatted');
|
||||
ActiveEntry.successMessages.set('email', null);
|
||||
} else if (email.indexOf("@") >= 0){
|
||||
ActiveEntry.errorMessages.set('email', null);
|
||||
ActiveEntry.successMessages.set('email', 'Email present');
|
||||
}
|
||||
};
|
||||
|
||||
ActiveEntry.verifyFullName = function (fullName) {
|
||||
if (fullName.length === 0) {
|
||||
ActiveEntry.errorMessages.set('fullName', 'Name is required');
|
||||
ActiveEntry.successMessages.set('fullName', null);
|
||||
} else if (fullName.indexOf(" ") === -1){
|
||||
ActiveEntry.errorMessages.set('fullName', 'Name is probably not complete');
|
||||
ActiveEntry.successMessages.set('fullName', null);
|
||||
} else if (fullName.indexOf(" ") >= 0){
|
||||
//ActiveEntry.errorMessages.set('fullName', 'Name present');
|
||||
ActiveEntry.errorMessages.set('fullName', null);
|
||||
ActiveEntry.successMessages.set('fullName', 'Name present');
|
||||
}
|
||||
};
|
||||
|
||||
ActiveEntry.verifyLDAPUsername = function(username) {
|
||||
if (username === "") {
|
||||
ActiveEntry.errorMessages.set("ldapUsername", "Username is required");
|
||||
ActiveEntry.successMessages.set("ldapUsername", null);
|
||||
} else {
|
||||
ActiveEntry.errorMessages.set("ldapUsername", null);
|
||||
ActiveEntry.successMessages.set("ldapUsername", "Username present");
|
||||
}
|
||||
};
|
||||
|
||||
ActiveEntry.verifyLDAPPassword = function(password) {
|
||||
if (password === "") {
|
||||
ActiveEntry.errorMessages.set("ldapPassword", "Password is required");
|
||||
ActiveEntry.successMessages.set("ldapPassword", null);
|
||||
} else {
|
||||
ActiveEntry.errorMessages.set("ldapPassword", null);
|
||||
ActiveEntry.successMessages.set("ldapPassword", "Password present");
|
||||
}
|
||||
};
|
||||
|
||||
ActiveEntry.signIn = function (emailValue, passwordValue){
|
||||
|
||||
ActiveEntry.verifyPassword(passwordValue);
|
||||
ActiveEntry.verifyEmail(emailValue);
|
||||
|
||||
var signInArgs = {email: emailValue, password: passwordValue};
|
||||
|
||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||
var passwordOptions = ActiveEntryConfig && ActiveEntryConfig.passwordOptions;
|
||||
|
||||
Meteor.call("isAccountInactive",emailValue, passwordOptions.inactivityPeriodDays, function(error, isAccountInactive) {
|
||||
if (error) {
|
||||
console.warn(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAccountInactive) {
|
||||
// Lock account
|
||||
ActiveEntry.lockAccount(signInArgs);
|
||||
} else {
|
||||
// Check account is locked
|
||||
ActiveEntry.isAccountLocked(signInArgs, passwordOptions);
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
ActiveEntry.lockAccount = function(signInArgs) {
|
||||
var emailValue = signInArgs && signInArgs.email;
|
||||
if (!emailValue) {
|
||||
return;
|
||||
}
|
||||
Meteor.call("lockAccount", emailValue);
|
||||
ActiveEntry.errorMessages.set('signInError', "Your account has been locked due to inactivity.");
|
||||
};
|
||||
|
||||
ActiveEntry.isAccountLocked = function(signInArgs, passwordOptions) {
|
||||
var emailValue = signInArgs && signInArgs.email;
|
||||
if (!emailValue) {
|
||||
return;
|
||||
}
|
||||
|
||||
Meteor.call("isAccountLocked", emailValue, function (error, isAccountLocked) {
|
||||
if (error) {
|
||||
console.warn(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAccountLocked) {
|
||||
ActiveEntry.errorMessages.set('signInError', "Your account has been locked.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get failed attempts count
|
||||
ActiveEntry.getFailedAttemptsCount(signInArgs, passwordOptions);
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
ActiveEntry.getFailedAttemptsCount = function(signInArgs, passwordOptions) {
|
||||
var emailValue = signInArgs && signInArgs.email;
|
||||
if (!emailValue) {
|
||||
return;
|
||||
}
|
||||
Meteor.call("getFailedAttemptsCount", emailValue, function(error, failedAttemptsCount) {
|
||||
if (error) {
|
||||
console.warn(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (failedAttemptsCount != passwordOptions.failedAttemptsLimit) {
|
||||
// Login with password
|
||||
ActiveEntry.loginWithPassword(signInArgs, passwordOptions);
|
||||
} else {
|
||||
ActiveEntry.errorMessages.set('signInError', "Your account has been locked.");
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
ActiveEntry.loginWithPassword = function(signInArgs, passwordOptions) {
|
||||
var emailValue = signInArgs && signInArgs.email;
|
||||
var password = signInArgs && signInArgs.password;
|
||||
|
||||
if (!emailValue || !password) {
|
||||
return;
|
||||
}
|
||||
|
||||
Meteor.loginWithPassword(emailValue, password, function (loginError, result) {
|
||||
if (loginError) {
|
||||
// Login failed
|
||||
if (loginError.error == 403) {
|
||||
ActiveEntry.updateFailedAttempts(signInArgs, passwordOptions, loginError);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Reset failed attempts
|
||||
Meteor.call("resetFailedAttempts", emailValue);
|
||||
|
||||
// Check password expiration
|
||||
ActiveEntry.isPasswordExpired(passwordOptions);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
ActiveEntry.isPasswordExpired = function(passwordOptions) {
|
||||
// if password expired, route to changePassword page
|
||||
Meteor.call("isPasswordExpired", passwordOptions.passwordExpirationDays, function(error, isPasswordExpired) {
|
||||
if (error) {
|
||||
console.warn(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
// Update last login time
|
||||
Meteor.call("updateLastLoginDate");
|
||||
|
||||
if (isPasswordExpired) {
|
||||
ActiveEntry.errorMessages.set('changePasswordError', 'Your password expired. Please change your password.');
|
||||
Router.go('/changePassword');
|
||||
} else {
|
||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||
Router.go(ActiveEntryConfig.signIn.destination);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ActiveEntry.updateFailedAttempts = function(signInArgs, passwordOptions, loginError) {
|
||||
var emailValue = signInArgs && signInArgs.email;
|
||||
|
||||
if (!emailValue) {
|
||||
return;
|
||||
}
|
||||
Meteor.call("updateFailedAttempts", emailValue, passwordOptions.failedAttemptsLimit, function(error, failedAttemptCount) {
|
||||
if (error) {
|
||||
console.warn(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (failedAttemptCount == passwordOptions.failedAttemptsLimit) {
|
||||
ActiveEntry.errorMessages.set('signInError', "Too many failed login attempts. Your account has been locked.");
|
||||
} else if (failedAttemptCount < passwordOptions.failedAttemptsLimit) {
|
||||
ActiveEntry.errorMessages.set('signInError', loginError.message + "<br />" +(passwordOptions.failedAttemptsLimit - failedAttemptCount) + " attempts remaining.");
|
||||
} else {
|
||||
ActiveEntry.errorMessages.set('signInError', loginError.message);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
ActiveEntry.loginWithLDAP = function(username, password) {
|
||||
ActiveEntry.verifyLDAPUsername(username);
|
||||
ActiveEntry.verifyLDAPPassword(password);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
|
||||
if (ActiveEntry.errorMessages.get("ldapUsername") || ActiveEntry.errorMessages.get("ldapPassword")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Meteor.loginWithLDAP(username, password, {
|
||||
// The dn value depends on what you want to search/auth against
|
||||
// The structure will depend on how your ldap server
|
||||
// is configured or structured.
|
||||
dn: "uid=" + username + ",ou=users,ou=system",
|
||||
// The search value is optional. Set it if your search does not
|
||||
// work with the bind dn.
|
||||
searchResultsProfileMap: [
|
||||
{
|
||||
resultKey: 'cn',
|
||||
profileProperty: 'fullName'
|
||||
},
|
||||
{
|
||||
resultKey: 'mail',
|
||||
profileProperty: 'email'
|
||||
}
|
||||
]
|
||||
}, function(error) {
|
||||
if (error) {
|
||||
ActiveEntry.errorMessages.set('signInError', error.errorType+" ["+error.error+"]");
|
||||
return;
|
||||
}
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
|
||||
// Update last login time
|
||||
Meteor.call("updateLastLoginDate");
|
||||
|
||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||
Router.go(ActiveEntryConfig.signIn.destination);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
ActiveEntry.signUp = function (emailValue, passwordValue, confirmPassword, fullName){
|
||||
ActiveEntry.verifyEmail(emailValue);
|
||||
ActiveEntry.verifyPassword(passwordValue);
|
||||
ActiveEntry.verifyConfirmPassword(passwordValue, confirmPassword);
|
||||
ActiveEntry.verifyFullName(fullName);
|
||||
ActiveEntry.errorMessages.set('signInError', null);
|
||||
|
||||
var errorIsFound = false;
|
||||
Object.keys(ActiveEntry.errorMessages.keys).forEach(function(key) {
|
||||
if (ActiveEntry.errorMessages.get(key) !== "null" && ActiveEntry.errorMessages.get(key) !== null) {
|
||||
errorIsFound = true;
|
||||
}
|
||||
});
|
||||
|
||||
if(errorIsFound) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Capitalize first letter of every word in fullName
|
||||
var capitalizedFullName = fullName.replace(/[^\s]+/g, function(str){
|
||||
return str.substr(0,1).toUpperCase()+str.substr(1).toLowerCase();
|
||||
});
|
||||
|
||||
Accounts.createUser({
|
||||
email: emailValue,
|
||||
password: passwordValue,
|
||||
profile: {
|
||||
fullName: capitalizedFullName
|
||||
}
|
||||
}, function (error, result) {
|
||||
if (error) {
|
||||
ActiveEntry.errorMessages.set('signInError', error.message);
|
||||
return;
|
||||
}
|
||||
// Add password in previousPasswords field
|
||||
ActiveEntry.insertHashedPassword(passwordValue);
|
||||
|
||||
// Update password set date
|
||||
ActiveEntry.updatePasswordSetDate();
|
||||
|
||||
// Update last login time
|
||||
Meteor.call("updateLastLoginDate");
|
||||
|
||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||
Router.go(ActiveEntryConfig.signUp.destination);
|
||||
|
||||
});
|
||||
};
|
||||
ActiveEntry.changePassword = function(oldPassword, password) {
|
||||
Meteor.call("checkPasswordExistence", new String(password).hashCode(), function(error, isPasswordExisted) {
|
||||
if (error) {
|
||||
console.warn(error.message);
|
||||
ActiveEntry.errorMessages.set('changePasswordError', error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPasswordExisted) {
|
||||
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, password, function(error) {
|
||||
if (error) {
|
||||
console.warn(error);
|
||||
ActiveEntry.errorMessages.set('changePasswordError', error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
// Save the new password
|
||||
ActiveEntry.insertHashedPassword(password);
|
||||
|
||||
// Update password expiration date
|
||||
ActiveEntry.updatePasswordSetDate();
|
||||
|
||||
// Logout
|
||||
ActiveEntry.signOut();
|
||||
// Go to signIn page for new entry
|
||||
Router.go('/entrySignIn');
|
||||
});
|
||||
}
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
ActiveEntry.forgotPassword = function(emailAddress) {
|
||||
ActiveEntry.verifyEmail(emailAddress);
|
||||
ActiveEntry.errorMessages.set("forgotPassword", null);
|
||||
ActiveEntry.successMessages.set("forgotPassword", null);
|
||||
|
||||
if (ActiveEntry.errorMessages.get("email")) {
|
||||
return;
|
||||
}
|
||||
|
||||
Accounts.forgotPassword({email:emailAddress }, function(error){
|
||||
if (error) {
|
||||
console.warn(error.message);
|
||||
ActiveEntry.errorMessages.set("forgotPassword", error.message);
|
||||
ActiveEntry.successMessages.set("forgotPassword", null);
|
||||
return;
|
||||
}
|
||||
|
||||
// Show email sent notification
|
||||
ActiveEntry.successMessages.set("forgotPassword", "Your password reset email is sent to <strong>"+emailAddress+"</strong>");
|
||||
});
|
||||
};
|
||||
|
||||
ActiveEntry.resetPassword = function(passwordValue, confirmPassword) {
|
||||
ActiveEntry.verifyPassword(passwordValue);
|
||||
ActiveEntry.verifyConfirmPassword(passwordValue, confirmPassword);
|
||||
ActiveEntry.errorMessages.set("resetPassword", null);
|
||||
|
||||
// Check error messages
|
||||
if (ActiveEntry.errorMessages.get("password") || ActiveEntry.errorMessages.get("confirm")) {
|
||||
return;
|
||||
}
|
||||
|
||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||
var passwordOptions = ActiveEntryConfig && ActiveEntryConfig.passwordOptions;
|
||||
|
||||
// Check token is expired
|
||||
Meteor.call('checkResetTokenIsExpired', Session.get('_resetPasswordToken'), passwordOptions.expireTimeInMinute, function(error, isTokenExpired) {
|
||||
if (error) {
|
||||
console.log(error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isTokenExpired) {
|
||||
console.log("Your link is expired");
|
||||
// Go to forgotPassword to create a new reset link
|
||||
ActiveEntry.errorMessages.set("forgotPassword", 'Your link is expired. Please create a new reset link.');
|
||||
Router.go('/forgotPassword');
|
||||
return;
|
||||
}
|
||||
|
||||
// Check password history
|
||||
Meteor.call("checkResetPasswordExistence", new String(passwordValue).hashCode(), Session.get('_resetPasswordToken'), function(error, isPasswordExisted) {
|
||||
if (error) {
|
||||
console.warn(error.message);
|
||||
ActiveEntry.errorMessages.set('resetPasswordError', error.message);
|
||||
return;
|
||||
}
|
||||
|
||||
if (isPasswordExisted) {
|
||||
|
||||
ActiveEntry.errorMessages.set('resetPasswordError', 'Password is used before. Please change your new password.');
|
||||
} else {
|
||||
|
||||
ActiveEntry.errorMessages.set('resetPasswordError', null);
|
||||
Accounts.resetPassword(Session.get('_resetPasswordToken'), passwordValue, function(error) {
|
||||
if (error) {
|
||||
ActiveEntry.errorMessages.set("resetPassword", error.message);
|
||||
return;
|
||||
}
|
||||
Session.set('_resetPasswordToken', null);
|
||||
// Save the new password
|
||||
ActiveEntry.insertHashedPassword(passwordValue);
|
||||
|
||||
// Update password expiration date
|
||||
ActiveEntry.updatePasswordSetDate();
|
||||
|
||||
// Update last login time
|
||||
Meteor.call("updateLastLoginDate");
|
||||
|
||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||
Router.go(ActiveEntryConfig.signIn.destination);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
// Insert hashed password in previousPasswords fields
|
||||
ActiveEntry.insertHashedPassword = function(passwordValue) {
|
||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||
var passwordHistoryCount = ActiveEntryConfig && ActiveEntryConfig.passwordOptions && ActiveEntryConfig.passwordOptions.passwordHistoryCount || 6;
|
||||
Meteor.call("insertHashedPassword", [new String(passwordValue).hashCode(),passwordHistoryCount]);
|
||||
};
|
||||
|
||||
ActiveEntry.updatePasswordSetDate = function() {
|
||||
Meteor.call("updatePasswordSetDate");
|
||||
};
|
||||
|
||||
ActiveEntry.signOut = function (){
|
||||
Meteor.logout();
|
||||
};
|
||||
|
||||
ActiveEntry.reset = function (){
|
||||
ActiveEntry.errorMessages.set('signInError', false);
|
||||
ActiveEntry.errorMessages.set('fullName', false);
|
||||
ActiveEntry.errorMessages.set('email', false);
|
||||
ActiveEntry.errorMessages.set('confirm', false);
|
||||
ActiveEntry.errorMessages.set('password', false);
|
||||
};
|
||||
|
||||
ActiveEntry.logoIsDisplayed = function (){
|
||||
var ActiveEntryConfig = Session.get('Photonic.ActiveEntry');
|
||||
return ActiveEntryConfig.logo.displayed;
|
||||
};
|
||||
@@ -1,59 +0,0 @@
|
||||
passwordValidationSettings = {};
|
||||
|
||||
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();
|
||||
});
|
||||
|
||||
checkPasswordStrength = function(password) {
|
||||
if (passwordValidationSettings.requireStrongPasswords) {
|
||||
// Check zxcvbn
|
||||
var zxcvbnResult = zxcvbn(password);
|
||||
if (zxcvbnResult && zxcvbnResult.score > 2) {
|
||||
return true;
|
||||
}
|
||||
|
||||
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 true;
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
String.prototype.hashCode = function() {
|
||||
var hash = 0, i, chr, len;
|
||||
if (this.length === 0) return hash;
|
||||
for (i = 0, len = this.length; i < len; i++) {
|
||||
chr = this.charCodeAt(i);
|
||||
hash = ((hash << 5) - hash) + chr;
|
||||
hash |= 0; // Convert to 32bit integer
|
||||
}
|
||||
return hash;
|
||||
};
|
||||
@@ -1,737 +0,0 @@
|
||||
/*!
|
||||
* jQuery Password Strength plugin for Twitter Bootstrap
|
||||
*
|
||||
* Copyright (c) 2008-2013 Tane Piper
|
||||
* Copyright (c) 2013 Alejandro Blanco
|
||||
* Dual licensed under the MIT and GPL licenses.
|
||||
*/
|
||||
|
||||
(function (jQuery) {
|
||||
// Source: src/rules.js
|
||||
|
||||
|
||||
|
||||
var rulesEngine = {};
|
||||
|
||||
try {
|
||||
if (!jQuery && module && module.exports) {
|
||||
var jQuery = require("jquery"),
|
||||
jsdom = require("jsdom").jsdom;
|
||||
jQuery = jQuery(jsdom().parentWindow);
|
||||
}
|
||||
} catch (ignore) {}
|
||||
|
||||
(function ($, rulesEngine) {
|
||||
"use strict";
|
||||
var validation = {};
|
||||
|
||||
rulesEngine.forbiddenSequences = [
|
||||
"0123456789", "abcdefghijklmnopqrstuvwxyz", "qwertyuiop", "asdfghjkl",
|
||||
"zxcvbnm", "!@#$%^&*()_+"
|
||||
];
|
||||
|
||||
validation.wordNotEmail = function (options, word, score) {
|
||||
if (word.match(
|
||||
/^([\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+\.)*[\w\!\#$\%\&\'\*\+\-\/\=\?\^\`{\|\}\~]+@((((([a-z0-9]{1}[a-z0-9\-]{0,62}[a-z0-9]{1})|[a-z])\.)+[a-z]{2,6})|(\d{1,3}\.){3}\d{1,3}(\:\d{1,5})?)$/i
|
||||
)) {
|
||||
return score;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
validation.wordLength = function (options, word, score) {
|
||||
var wordlen = word.length,
|
||||
lenScore = Math.pow(wordlen, options.rules.raisePower);
|
||||
if (wordlen < options.common.minChar) {
|
||||
lenScore = (lenScore + score);
|
||||
}
|
||||
return lenScore;
|
||||
};
|
||||
|
||||
validation.wordSimilarToUsername = function (options, word, score) {
|
||||
var username = $(options.common.usernameField).val();
|
||||
if (username && word.toLowerCase().match(username.replace(
|
||||
/[\-\[\]\/\{\}\(\)\*\+\=\?\:\.\\\^\$\|\!\,]/g, "\\$&").toLowerCase())) {
|
||||
return score;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
validation.wordTwoCharacterClasses = function (options, word, score) {
|
||||
if (word.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/) ||
|
||||
(word.match(/([a-zA-Z])/) && word.match(/([0-9])/)) ||
|
||||
(word.match(/(.[!,@,#,$,%,\^,&,*,?,_,~])/) && word.match(/[a-zA-Z0-9_]/))) {
|
||||
return score;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
validation.wordRepetitions = function (options, word, score) {
|
||||
if (word.match(/(.)\1\1/)) {
|
||||
return score;
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
validation.wordSequences = function (options, word, score) {
|
||||
var found = false,
|
||||
j;
|
||||
if (word.length > 2) {
|
||||
$.each(rulesEngine.forbiddenSequences, function (idx, seq) {
|
||||
if (found) {
|
||||
return;
|
||||
}
|
||||
var sequences = [seq, seq.split('').reverse().join('')];
|
||||
$.each(sequences, function (idx, sequence) {
|
||||
for (j = 0; j < (word.length - 2); j += 1) { // iterate the word trough a sliding window of size 3:
|
||||
if (sequence.indexOf(word.toLowerCase().substring(j, j + 3)) > -1) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
if (found) {
|
||||
return score;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
};
|
||||
|
||||
validation.wordLowercase = function (options, word, score) {
|
||||
return word.match(/[a-z]/) && score;
|
||||
};
|
||||
|
||||
validation.wordUppercase = function (options, word, score) {
|
||||
return word.match(/[A-Z]/) && score;
|
||||
};
|
||||
|
||||
validation.wordOneNumber = function (options, word, score) {
|
||||
return word.match(/\d+/) && score;
|
||||
};
|
||||
|
||||
validation.wordThreeNumbers = function (options, word, score) {
|
||||
return word.match(/(.*[0-9].*[0-9].*[0-9])/) && score;
|
||||
};
|
||||
|
||||
validation.wordOneSpecialChar = function (options, word, score) {
|
||||
return word.match(/[!,@,#,$,%,\^,&,*,?,_,~]/) && score;
|
||||
};
|
||||
|
||||
validation.wordTwoSpecialChar = function (options, word, score) {
|
||||
return word.match(/(.*[!,@,#,$,%,\^,&,*,?,_,~].*[!,@,#,$,%,\^,&,*,?,_,~])/) && score;
|
||||
};
|
||||
|
||||
validation.wordUpperLowerCombo = function (options, word, score) {
|
||||
return word.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/) && score;
|
||||
};
|
||||
|
||||
validation.wordLetterNumberCombo = function (options, word, score) {
|
||||
return word.match(/([a-zA-Z])/) && word.match(/([0-9])/) && score;
|
||||
};
|
||||
|
||||
validation.wordLetterNumberCharCombo = function (options, word, score) {
|
||||
return word.match(
|
||||
/([a-zA-Z0-9].*[!,@,#,$,%,\^,&,*,?,_,~])|([!,@,#,$,%,\^,&,*,?,_,~].*[a-zA-Z0-9])/) &&
|
||||
score;
|
||||
};
|
||||
|
||||
rulesEngine.validation = validation;
|
||||
|
||||
rulesEngine.executeRules = function (options, word) {
|
||||
var totalScore = 0;
|
||||
|
||||
$.each(options.rules.activated, function (rule, active) {
|
||||
if (active) {
|
||||
var score = options.rules.scores[rule],
|
||||
funct = rulesEngine.validation[rule],
|
||||
result,
|
||||
errorMessage;
|
||||
|
||||
if (!$.isFunction(funct)) {
|
||||
funct = options.rules.extra[rule];
|
||||
}
|
||||
|
||||
if ($.isFunction(funct)) {
|
||||
result = funct(options, word, score);
|
||||
if (result) {
|
||||
totalScore += result;
|
||||
}
|
||||
if (result < 0 || (!$.isNumeric(result) && !result)) {
|
||||
errorMessage = options.ui.spanError(options, rule);
|
||||
if (errorMessage.length > 0) {
|
||||
options.instances.errors.push(errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return totalScore;
|
||||
};
|
||||
}(jQuery, rulesEngine));
|
||||
|
||||
try {
|
||||
if (module && module.exports) {
|
||||
module.exports = rulesEngine;
|
||||
}
|
||||
} catch (ignore) {}
|
||||
|
||||
// Source: src/options.js
|
||||
|
||||
|
||||
|
||||
var defaultOptions = {};
|
||||
|
||||
defaultOptions.common = {};
|
||||
defaultOptions.common.minChar = 6;
|
||||
defaultOptions.common.usernameField = "#username";
|
||||
defaultOptions.common.userInputs = [
|
||||
// Selectors for input fields with user input
|
||||
];
|
||||
defaultOptions.common.onLoad = undefined;
|
||||
defaultOptions.common.onKeyUp = undefined;
|
||||
defaultOptions.common.zxcvbn = false;
|
||||
defaultOptions.common.zxcvbnTerms = [
|
||||
// List of disrecommended words
|
||||
];
|
||||
defaultOptions.common.debug = false;
|
||||
|
||||
defaultOptions.rules = {};
|
||||
defaultOptions.rules.extra = {};
|
||||
defaultOptions.rules.scores = {
|
||||
wordNotEmail: -100,
|
||||
wordLength: -50,
|
||||
wordSimilarToUsername: -100,
|
||||
wordSequences: -20,
|
||||
wordTwoCharacterClasses: 2,
|
||||
wordRepetitions: -25,
|
||||
wordLowercase: 1,
|
||||
wordUppercase: 3,
|
||||
wordOneNumber: 3,
|
||||
wordThreeNumbers: 5,
|
||||
wordOneSpecialChar: 3,
|
||||
wordTwoSpecialChar: 5,
|
||||
wordUpperLowerCombo: 2,
|
||||
wordLetterNumberCombo: 2,
|
||||
wordLetterNumberCharCombo: 2
|
||||
};
|
||||
defaultOptions.rules.activated = {
|
||||
wordNotEmail: true,
|
||||
wordLength: true,
|
||||
wordSimilarToUsername: true,
|
||||
wordSequences: true,
|
||||
wordTwoCharacterClasses: false,
|
||||
wordRepetitions: false,
|
||||
wordLowercase: true,
|
||||
wordUppercase: true,
|
||||
wordOneNumber: true,
|
||||
wordThreeNumbers: true,
|
||||
wordOneSpecialChar: true,
|
||||
wordTwoSpecialChar: true,
|
||||
wordUpperLowerCombo: true,
|
||||
wordLetterNumberCombo: true,
|
||||
wordLetterNumberCharCombo: true
|
||||
};
|
||||
defaultOptions.rules.raisePower = 1.4;
|
||||
|
||||
defaultOptions.ui = {};
|
||||
defaultOptions.ui.bootstrap2 = false;
|
||||
defaultOptions.ui.bootstrap4 = false;
|
||||
defaultOptions.ui.colorClasses = ["danger", "warning", "success"];
|
||||
defaultOptions.ui.showProgressBar = true;
|
||||
defaultOptions.ui.showPopover = false;
|
||||
defaultOptions.ui.popoverPlacement = "bottom";
|
||||
defaultOptions.ui.showStatus = false;
|
||||
defaultOptions.ui.spanError = function (options, key) {
|
||||
"use strict";
|
||||
var text = options.ui.errorMessages[key];
|
||||
if (!text) {
|
||||
return '';
|
||||
}
|
||||
return '<span style="color: #d52929">' + text + '</span>';
|
||||
};
|
||||
defaultOptions.ui.popoverError = function (errors) {
|
||||
"use strict";
|
||||
var message = "<div>Errors:<ul class='error-list' style='margin-bottom: 0;'>";
|
||||
|
||||
jQuery.each(errors, function (idx, err) {
|
||||
message += "<li>" + err + "</li>";
|
||||
});
|
||||
message += "</ul></div>";
|
||||
return message;
|
||||
};
|
||||
defaultOptions.ui.errorMessages = {
|
||||
wordLength: "Your password is too short",
|
||||
wordNotEmail: "Do not use your email as your password",
|
||||
wordSimilarToUsername: "Your password cannot contain your username",
|
||||
wordTwoCharacterClasses: "Use different character classes",
|
||||
wordRepetitions: "Too many repetitions",
|
||||
wordSequences: "Your password contains sequences"
|
||||
};
|
||||
defaultOptions.ui.verdicts = ["Weak", "Normal", "Medium", "Strong", "Very Strong"];
|
||||
defaultOptions.ui.showVerdicts = true;
|
||||
defaultOptions.ui.showVerdictsInsideProgressBar = false;
|
||||
defaultOptions.ui.useVerdictCssClass = false;
|
||||
defaultOptions.ui.showErrors = false;
|
||||
defaultOptions.ui.container = undefined;
|
||||
defaultOptions.ui.viewports = {
|
||||
progress: undefined,
|
||||
verdict: undefined,
|
||||
errors: undefined
|
||||
};
|
||||
defaultOptions.ui.scores = [14, 26, 38, 50];
|
||||
|
||||
// Source: src/ui.js
|
||||
|
||||
|
||||
|
||||
var ui = {};
|
||||
|
||||
(function ($, ui) {
|
||||
"use strict";
|
||||
|
||||
var statusClasses = ["error", "warning", "success"];
|
||||
|
||||
ui.getContainer = function (options, $el) {
|
||||
var $container;
|
||||
|
||||
$container = $(options.ui.container);
|
||||
if (!($container && $container.length === 1)) {
|
||||
$container = $el.parent();
|
||||
}
|
||||
return $container;
|
||||
};
|
||||
|
||||
ui.findElement = function ($container, viewport, cssSelector) {
|
||||
if (viewport) {
|
||||
return $container.find(viewport).find(cssSelector);
|
||||
}
|
||||
return $container.find(cssSelector);
|
||||
};
|
||||
|
||||
ui.getUIElements = function (options, $el) {
|
||||
var $container, selector, result;
|
||||
|
||||
if (options.instances.viewports) {
|
||||
return options.instances.viewports;
|
||||
}
|
||||
|
||||
$container = ui.getContainer(options, $el);
|
||||
|
||||
result = {};
|
||||
if (options.ui.bootstrap4) {
|
||||
selector = "progress.progress";
|
||||
} else {
|
||||
selector = "div.progress";
|
||||
}
|
||||
result.$progressbar = ui.findElement($container, options.ui.viewports.progress,
|
||||
selector);
|
||||
if (options.ui.showVerdictsInsideProgressBar) {
|
||||
result.$verdict = result.$progressbar.find("span.password-verdict");
|
||||
}
|
||||
|
||||
if (!options.ui.showPopover) {
|
||||
if (!options.ui.showVerdictsInsideProgressBar) {
|
||||
result.$verdict = ui.findElement($container, options.ui.viewports.verdict,
|
||||
"span.password-verdict");
|
||||
}
|
||||
result.$errors = ui.findElement($container, options.ui.viewports.errors,
|
||||
"ul.error-list");
|
||||
}
|
||||
|
||||
options.instances.viewports = result;
|
||||
return result;
|
||||
};
|
||||
|
||||
ui.initProgressBar = function (options, $el) {
|
||||
var $container = ui.getContainer(options, $el),
|
||||
progressbar = "<div class='progress'><div class='"; // Boostrap 2
|
||||
|
||||
if (!options.ui.bootstrap2 && !options.ui.bootstrap4) {
|
||||
// Bootstrap 3
|
||||
progressbar += "progress-";
|
||||
}
|
||||
progressbar += "bar'>";
|
||||
if (options.ui.bootstrap4) {
|
||||
// Boostrap 4
|
||||
progressbar = "<progress class='progress' value='0' max='100'>";
|
||||
}
|
||||
if (options.ui.showVerdictsInsideProgressBar) {
|
||||
progressbar += "<span class='password-verdict'></span>";
|
||||
}
|
||||
if (options.ui.bootstrap4) {
|
||||
progressbar += "</progress>";
|
||||
} else {
|
||||
progressbar += "</div></div>";
|
||||
}
|
||||
|
||||
if (options.ui.viewports.progress) {
|
||||
$container.find(options.ui.viewports.progress).append(progressbar);
|
||||
} else {
|
||||
$(progressbar).insertAfter($el);
|
||||
}
|
||||
};
|
||||
|
||||
ui.initHelper = function (options, $el, html, viewport) {
|
||||
var $container = ui.getContainer(options, $el);
|
||||
if (viewport) {
|
||||
$container.find(viewport).append(html);
|
||||
} else {
|
||||
$(html).insertAfter($el);
|
||||
}
|
||||
};
|
||||
|
||||
ui.initVerdict = function (options, $el) {
|
||||
ui.initHelper(options, $el, "<span class='password-verdict'></span>",
|
||||
options.ui.viewports.verdict);
|
||||
};
|
||||
|
||||
ui.initErrorList = function (options, $el) {
|
||||
ui.initHelper(options, $el, "<ul class='error-list'></ul>",
|
||||
options.ui.viewports.errors);
|
||||
};
|
||||
|
||||
ui.initPopover = function (options, $el) {
|
||||
$el.popover("destroy");
|
||||
$el.popover({
|
||||
html: true,
|
||||
placement: options.ui.popoverPlacement,
|
||||
trigger: "manual",
|
||||
content: " "
|
||||
});
|
||||
};
|
||||
|
||||
ui.initUI = function (options, $el) {
|
||||
if (options.ui.showPopover) {
|
||||
ui.initPopover(options, $el);
|
||||
} else {
|
||||
if (options.ui.showErrors) {
|
||||
ui.initErrorList(options, $el);
|
||||
}
|
||||
if (options.ui.showVerdicts && !options.ui.showVerdictsInsideProgressBar) {
|
||||
ui.initVerdict(options, $el);
|
||||
}
|
||||
}
|
||||
if (options.ui.showProgressBar) {
|
||||
ui.initProgressBar(options, $el);
|
||||
}
|
||||
};
|
||||
|
||||
ui.updateProgressBar = function (options, $el, cssClass, percentage) {
|
||||
var $progressbar = ui.getUIElements(options, $el).$progressbar,
|
||||
$bar = $progressbar.find(".progress-bar"),
|
||||
cssPrefix = "progress-";
|
||||
|
||||
if (options.ui.bootstrap2) {
|
||||
$bar = $progressbar.find(".bar");
|
||||
cssPrefix = "";
|
||||
}
|
||||
|
||||
$.each(options.ui.colorClasses, function (idx, value) {
|
||||
if (options.ui.bootstrap4) {
|
||||
$progressbar.removeClass(cssPrefix + value);
|
||||
} else {
|
||||
$bar.removeClass(cssPrefix + "bar-" + value);
|
||||
}
|
||||
});
|
||||
if (options.ui.bootstrap4) {
|
||||
$progressbar.addClass(cssPrefix + options.ui.colorClasses[cssClass]);
|
||||
$progressbar.val(percentage);
|
||||
} else {
|
||||
$bar.addClass(cssPrefix + "bar-" + options.ui.colorClasses[cssClass]);
|
||||
$bar.css("width", percentage + '%');
|
||||
}
|
||||
};
|
||||
|
||||
ui.updateVerdict = function (options, $el, cssClass, text) {
|
||||
var $verdict = ui.getUIElements(options, $el).$verdict;
|
||||
$verdict.removeClass(options.ui.colorClasses.join(' '));
|
||||
if (cssClass > -1) {
|
||||
$verdict.addClass(options.ui.colorClasses[cssClass]);
|
||||
}
|
||||
$verdict.html(text);
|
||||
};
|
||||
|
||||
ui.updateErrors = function (options, $el) {
|
||||
var $errors = ui.getUIElements(options, $el).$errors,
|
||||
html = "";
|
||||
$.each(options.instances.errors, function (idx, err) {
|
||||
html += "<li>" + err + "</li>";
|
||||
});
|
||||
$errors.html(html);
|
||||
};
|
||||
|
||||
ui.updatePopover = function (options, $el, verdictText) {
|
||||
var popover = $el.data("bs.popover"),
|
||||
html = "",
|
||||
hide = true;
|
||||
|
||||
if (options.ui.showVerdicts &&
|
||||
!options.ui.showVerdictsInsideProgressBar &&
|
||||
verdictText.length > 0) {
|
||||
html = "<h5><span class='password-verdict'>" + verdictText +
|
||||
"</span></h5>";
|
||||
hide = false;
|
||||
}
|
||||
if (options.ui.showErrors) {
|
||||
if (options.instances.errors.length > 0) {
|
||||
hide = false;
|
||||
}
|
||||
html += options.ui.popoverError(options.instances.errors);
|
||||
}
|
||||
|
||||
if (hide) {
|
||||
$el.popover("hide");
|
||||
return;
|
||||
}
|
||||
|
||||
if (options.ui.bootstrap2) {
|
||||
popover = $el.data("popover");
|
||||
}
|
||||
|
||||
if (popover.$arrow && popover.$arrow.parents("body").length > 0) {
|
||||
$el.find("+ .popover .popover-content").html(html);
|
||||
} else {
|
||||
// It's hidden
|
||||
popover.options.content = html;
|
||||
$el.popover("show");
|
||||
}
|
||||
};
|
||||
|
||||
ui.updateFieldStatus = function (options, $el, cssClass) {
|
||||
var targetClass = options.ui.bootstrap2 ? ".control-group" : ".form-group",
|
||||
$container = $el.parents(targetClass).first();
|
||||
|
||||
$.each(statusClasses, function (idx, css) {
|
||||
if (!options.ui.bootstrap2) {
|
||||
css = "has-" + css;
|
||||
}
|
||||
$container.removeClass(css);
|
||||
});
|
||||
|
||||
cssClass = statusClasses[cssClass];
|
||||
if (!options.ui.bootstrap2) {
|
||||
cssClass = "has-" + cssClass;
|
||||
}
|
||||
$container.addClass(cssClass);
|
||||
};
|
||||
|
||||
ui.percentage = function (score, maximun) {
|
||||
var result = Math.floor(100 * score / maximun);
|
||||
result = result <= 0 ? 1 : result; // Don't show the progress bar empty
|
||||
result = result > 100 ? 100 : result;
|
||||
return result;
|
||||
};
|
||||
|
||||
ui.getVerdictAndCssClass = function (options, score) {
|
||||
var cssClass, verdictText, level;
|
||||
|
||||
if (score <= 0) {
|
||||
cssClass = 0;
|
||||
level = -1;
|
||||
verdictText = options.ui.verdicts[0];
|
||||
} else if (score < options.ui.scores[0]) {
|
||||
cssClass = 0;
|
||||
level = 0;
|
||||
verdictText = options.ui.verdicts[0];
|
||||
} else if (score < options.ui.scores[1]) {
|
||||
cssClass = 0;
|
||||
level = 1;
|
||||
verdictText = options.ui.verdicts[1];
|
||||
} else if (score < options.ui.scores[2]) {
|
||||
cssClass = 1;
|
||||
level = 2;
|
||||
verdictText = options.ui.verdicts[2];
|
||||
} else if (score < options.ui.scores[3]) {
|
||||
cssClass = 1;
|
||||
level = 3;
|
||||
verdictText = options.ui.verdicts[3];
|
||||
} else {
|
||||
cssClass = 2;
|
||||
level = 4;
|
||||
verdictText = options.ui.verdicts[4];
|
||||
}
|
||||
|
||||
return [verdictText, cssClass, level];
|
||||
};
|
||||
|
||||
ui.updateUI = function (options, $el, score) {
|
||||
var cssClass, barPercentage, verdictText, verdictCssClass;
|
||||
|
||||
cssClass = ui.getVerdictAndCssClass(options, score);
|
||||
verdictText = score === 0 ? '' : cssClass[0];
|
||||
cssClass = cssClass[1];
|
||||
verdictCssClass = options.ui.useVerdictCssClass ? cssClass : -1;
|
||||
|
||||
if (options.ui.showProgressBar) {
|
||||
barPercentage = ui.percentage(score, options.ui.scores[3]);
|
||||
ui.updateProgressBar(options, $el, cssClass, barPercentage);
|
||||
if (options.ui.showVerdictsInsideProgressBar) {
|
||||
ui.updateVerdict(options, $el, verdictCssClass, verdictText);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.ui.showStatus) {
|
||||
ui.updateFieldStatus(options, $el, cssClass);
|
||||
}
|
||||
|
||||
if (options.ui.showPopover) {
|
||||
ui.updatePopover(options, $el, verdictText);
|
||||
} else {
|
||||
if (options.ui.showVerdicts && !options.ui.showVerdictsInsideProgressBar) {
|
||||
ui.updateVerdict(options, $el, verdictCssClass, verdictText);
|
||||
}
|
||||
if (options.ui.showErrors) {
|
||||
ui.updateErrors(options, $el);
|
||||
}
|
||||
}
|
||||
};
|
||||
}(jQuery, ui));
|
||||
|
||||
// Source: src/methods.js
|
||||
|
||||
|
||||
|
||||
var methods = {};
|
||||
|
||||
(function ($, methods) {
|
||||
"use strict";
|
||||
var onKeyUp, applyToAll;
|
||||
|
||||
onKeyUp = function (event) {
|
||||
var $el = $(event.target),
|
||||
options = $el.data("pwstrength-bootstrap"),
|
||||
word = $el.val(),
|
||||
userInputs,
|
||||
verdictText,
|
||||
verdictLevel,
|
||||
score;
|
||||
|
||||
if (options === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
options.instances.errors = [];
|
||||
if (word.length === 0) {
|
||||
score = 0;
|
||||
} else {
|
||||
if (options.common.zxcvbn) {
|
||||
userInputs = [];
|
||||
$.each(options.common.userInputs.concat([options.common.usernameField]), function (
|
||||
idx, selector) {
|
||||
var value = $(selector).val();
|
||||
if (value) {
|
||||
userInputs.push(value);
|
||||
}
|
||||
});
|
||||
userInputs = userInputs.concat(options.common.zxcvbnTerms);
|
||||
score = Math.log2(zxcvbn(word, userInputs).guesses);
|
||||
} else {
|
||||
score = rulesEngine.executeRules(options, word);
|
||||
}
|
||||
}
|
||||
ui.updateUI(options, $el, score);
|
||||
verdictText = ui.getVerdictAndCssClass(options, score);
|
||||
verdictLevel = verdictText[2];
|
||||
verdictText = verdictText[0];
|
||||
|
||||
if (options.common.debug) {
|
||||
console.log(score + ' - ' + verdictText);
|
||||
}
|
||||
|
||||
if ($.isFunction(options.common.onKeyUp)) {
|
||||
options.common.onKeyUp(event, {
|
||||
score: score,
|
||||
verdictText: verdictText,
|
||||
verdictLevel: verdictLevel
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
methods.init = function (settings) {
|
||||
this.each(function (idx, el) {
|
||||
// Make it deep extend (first param) so it extends too the
|
||||
// rules and other inside objects
|
||||
var clonedDefaults = $.extend(true, {}, defaultOptions),
|
||||
localOptions = $.extend(true, clonedDefaults, settings),
|
||||
$el = $(el);
|
||||
|
||||
localOptions.instances = {};
|
||||
$el.data("pwstrength-bootstrap", localOptions);
|
||||
$el.on("keyup", onKeyUp);
|
||||
$el.on("change", onKeyUp);
|
||||
$el.on("paste", onKeyUp);
|
||||
|
||||
ui.initUI(localOptions, $el);
|
||||
if ($.trim($el.val())) { // Not empty, calculate the strength
|
||||
$el.trigger("keyup");
|
||||
}
|
||||
|
||||
if ($.isFunction(localOptions.common.onLoad)) {
|
||||
localOptions.common.onLoad();
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
methods.destroy = function () {
|
||||
this.each(function (idx, el) {
|
||||
var $el = $(el),
|
||||
options = $el.data("pwstrength-bootstrap"),
|
||||
elements = ui.getUIElements(options, $el);
|
||||
elements.$progressbar.remove();
|
||||
elements.$verdict.remove();
|
||||
elements.$errors.remove();
|
||||
$el.removeData("pwstrength-bootstrap");
|
||||
});
|
||||
};
|
||||
|
||||
methods.forceUpdate = function () {
|
||||
this.each(function (idx, el) {
|
||||
var event = {
|
||||
target: el
|
||||
};
|
||||
onKeyUp(event);
|
||||
});
|
||||
};
|
||||
|
||||
methods.addRule = function (name, method, score, active) {
|
||||
this.each(function (idx, el) {
|
||||
var options = $(el).data("pwstrength-bootstrap");
|
||||
|
||||
options.rules.activated[name] = active;
|
||||
options.rules.scores[name] = score;
|
||||
options.rules.extra[name] = method;
|
||||
});
|
||||
};
|
||||
|
||||
applyToAll = function (rule, prop, value) {
|
||||
this.each(function (idx, el) {
|
||||
$(el).data("pwstrength-bootstrap").rules[prop][rule] = value;
|
||||
});
|
||||
};
|
||||
|
||||
methods.changeScore = function (rule, score) {
|
||||
applyToAll.call(this, rule, "scores", score);
|
||||
};
|
||||
|
||||
methods.ruleActive = function (rule, active) {
|
||||
applyToAll.call(this, rule, "activated", active);
|
||||
};
|
||||
|
||||
$.fn.pwstrength = function (method) {
|
||||
var result;
|
||||
|
||||
if (methods[method]) {
|
||||
result = methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
} else if (typeof method === "object" || !method) {
|
||||
result = methods.init.apply(this, arguments);
|
||||
} else {
|
||||
$.error("Method " + method + " does not exist on jQuery.pwstrength-bootstrap");
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
}(jQuery, methods));
|
||||
}(jQuery));
|
||||
@@ -1,89 +0,0 @@
|
||||
Package.describe({
|
||||
name: 'clinical:active-entry',
|
||||
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'
|
||||
});
|
||||
|
||||
Package.onUse(function (api) {
|
||||
api.versionsFrom('1.1.0.3');
|
||||
|
||||
api.use([
|
||||
'meteor-platform',
|
||||
'templating',
|
||||
'clinical:router@2.0.19',
|
||||
'grove:less@0.1.1',
|
||||
'session',
|
||||
'reactive-dict'
|
||||
//'codetheweb:zxcvbn'
|
||||
], ['client']);
|
||||
|
||||
api.use([
|
||||
'accounts-base',
|
||||
'accounts-password'
|
||||
]);
|
||||
|
||||
api.use([
|
||||
'zuuk:stale-session@1.0.8',
|
||||
'random'
|
||||
], ['client', 'server']);
|
||||
|
||||
api.addFiles([
|
||||
'lib/ActiveEntry.js',
|
||||
'lib/Accounts.js'
|
||||
]);
|
||||
|
||||
api.addFiles([
|
||||
'lib/jquery.pwstrength.bootstrap.js',
|
||||
'lib/checkPasswordStrength.js',
|
||||
'lib/hashCodeGenerator.js'
|
||||
], ['client']);
|
||||
|
||||
api.imply('accounts-base');
|
||||
api.imply('accounts-password');
|
||||
|
||||
api.addFiles([
|
||||
'components/entryPages.js',
|
||||
'components/entryPages.less',
|
||||
|
||||
'components/entrySignIn/entrySignIn.html',
|
||||
'components/entrySignIn/entrySignIn.js',
|
||||
'components/entrySignIn/entrySignIn.less',
|
||||
|
||||
'components/entrySignUp/entrySignUp.html',
|
||||
'components/entrySignUp/entrySignUp.js',
|
||||
'components/entrySignUp/entrySignUp.less',
|
||||
|
||||
'components/forgotPassword/forgotPassword.html',
|
||||
'components/forgotPassword/forgotPassword.js',
|
||||
'components/forgotPassword/forgotPassword.less',
|
||||
|
||||
'components/changePassword/changePassword.html',
|
||||
'components/changePassword/changePassword.js',
|
||||
'components/changePassword/changePassword.less',
|
||||
|
||||
'components/resetPassword/resetPassword.html',
|
||||
'components/resetPassword/resetPassword.js'
|
||||
], ['client']);
|
||||
|
||||
|
||||
api.addFiles('server/methods.js', "server", {testOnly: true});
|
||||
|
||||
api.export("ActiveEntry");
|
||||
});
|
||||
|
||||
|
||||
Package.onTest(function (api) {
|
||||
api.use([
|
||||
'templating',
|
||||
'clinical:router@2.0.19',
|
||||
'grove:less@0.1.1',
|
||||
'standard-app-packages'
|
||||
], ['client']);
|
||||
|
||||
api.use('tinytest');
|
||||
api.use('clinical:active-entry');
|
||||
api.use('clinical:verification');
|
||||
api.addFiles('tests/gagarin/activeEntryTests.js');
|
||||
});
|
||||
@@ -1,202 +0,0 @@
|
||||
Meteor.methods({
|
||||
initializeEntryUsers: function (){
|
||||
console.log('Initializing Users', Meteor.users.find().fetch());
|
||||
|
||||
},
|
||||
|
||||
dropEntryUsers: function (){
|
||||
console.log('Drop Users', Meteor.users.find().fetch());
|
||||
Meteor.users.find().forEach(function(user){
|
||||
Meteor.users.remove({_id: user._id});
|
||||
});
|
||||
},
|
||||
|
||||
insertHashedPassword: function(passwordParameters) {
|
||||
var hashedPassword = passwordParameters[0];
|
||||
var passwordHistoryCount = passwordParameters[1];
|
||||
|
||||
var userId = Meteor.userId();
|
||||
var previousPasswords = Meteor.users.findOne({_id: userId}).previousPasswords;
|
||||
if (previousPasswords) {
|
||||
if (previousPasswords.length == passwordHistoryCount) {
|
||||
// Remove oldest password
|
||||
var ascSortedPasswords = _.sortBy(previousPasswords, function(previousPassword){ return previousPassword.createdAt; });
|
||||
ascSortedPasswords.splice(0, 1);
|
||||
previousPasswords = ascSortedPasswords;
|
||||
}
|
||||
|
||||
previousPasswords.push({hashedPassword: hashedPassword, createdAt: new Date()});
|
||||
Meteor.users.update({_id: userId}, {$set: {previousPasswords: previousPasswords}});
|
||||
} else {
|
||||
Meteor.users.update({_id: userId}, {$set: {previousPasswords: [{hashedPassword: hashedPassword, createdAt: new Date(), select: false}]}});
|
||||
}
|
||||
},
|
||||
|
||||
checkPasswordExistence: function(hashedPassword) {
|
||||
var previousPasswords = Meteor.users.find({_id: Meteor.userId()}).fetch()[0].previousPasswords;
|
||||
for(var i=0; i< previousPasswords.length; i++) {
|
||||
var recordedHashedPassword = previousPasswords[i].hashedPassword;
|
||||
if (recordedHashedPassword == hashedPassword) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
getFailedAttemptsCount: function(emailAddress) {
|
||||
// Check if the user actually exists, and if not, stop here
|
||||
var currentUser = Meteor.users.findOne({"emails.address": emailAddress});
|
||||
if (!currentUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
return currentUser.failedPasswordAttempts || 0;
|
||||
},
|
||||
|
||||
updateFailedAttempts: function(emailAddress, failedAttemptsLimit) {
|
||||
|
||||
// Check if the user actually exists, and if not, stop here
|
||||
var currentUser = Meteor.users.findOne({"emails.address": emailAddress});
|
||||
if (!currentUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
var failedAttemptCount = currentUser.failedPasswordAttempts || 0;
|
||||
if (failedAttemptCount == failedAttemptsLimit) {
|
||||
return failedAttemptCount;
|
||||
} else {
|
||||
if (failedAttemptCount == (failedAttemptsLimit - 1)) {
|
||||
// Locked user account
|
||||
Meteor.users.update({"emails.address": emailAddress}, {$set: {"profile.isLocked": true, failedPasswordAttempts: failedAttemptCount + 1}});
|
||||
} else if (failedAttemptCount < (failedAttemptsLimit - 1)) {
|
||||
Meteor.users.update({"emails.address": emailAddress}, {$set: {failedPasswordAttempts: failedAttemptCount + 1}});
|
||||
}
|
||||
}
|
||||
|
||||
return failedAttemptCount + 1;
|
||||
},
|
||||
|
||||
lockAccount: function(emailAddress) {
|
||||
// Check if the user actually exists, and if not, stop here
|
||||
var currentUser = Meteor.users.findOne({"emails.address": emailAddress});
|
||||
if (!currentUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
Meteor.users.update({"emails.address": emailAddress}, {$set: {"profile.isLocked": true}});
|
||||
},
|
||||
|
||||
resetFailedAttempts: function(emailAddress) {
|
||||
Meteor.users.update({"emails.address": emailAddress}, {$set: {failedPasswordAttempts: 0}});
|
||||
},
|
||||
|
||||
updatePasswordSetDate: function() {
|
||||
Meteor.users.update({_id: Meteor.userId()}, {$set: {"services.password.setDate": new Date()}});
|
||||
},
|
||||
|
||||
isPasswordExpired: function(passwordExpirationDays) {
|
||||
var passwordSetDate = Meteor.users.find({_id: Meteor.userId()}).fetch()[0].services.password.setDate;
|
||||
if (!passwordSetDate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
passwordSetDate.setDate(passwordSetDate.getDate() + passwordExpirationDays);
|
||||
|
||||
if (passwordSetDate <= new Date()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
isAccountLocked: function(emailAddress) {
|
||||
// Check if the user actually exists, and if not, stop here
|
||||
var currentUser = Meteor.users.findOne({"emails.address": emailAddress});
|
||||
if (!currentUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
return currentUser.profile.isLocked || false;
|
||||
},
|
||||
|
||||
updateLastLoginDate: function () {
|
||||
var user = Meteor.users.findOne(Meteor.userId());
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
var priorLoginDate = user.lastLoginDate;
|
||||
if (!priorLoginDate) {
|
||||
priorLoginDate = new Date();
|
||||
}
|
||||
// Update priorLoginDate and lastLoginDate
|
||||
Meteor.users.update({_id: Meteor.userId()}, {$set: {priorLoginDate: priorLoginDate, lastLoginDate: new Date()}});
|
||||
},
|
||||
|
||||
isAccountInactive: function (emailAddress, inactivityPeriodDays) {
|
||||
// Check if the user actually exists, and if not, stop here
|
||||
var currentUser = Meteor.users.findOne({"emails.address": emailAddress});
|
||||
if (!currentUser) {
|
||||
return;
|
||||
}
|
||||
|
||||
var lastLoginDate = currentUser.lastLoginDate;
|
||||
if (!lastLoginDate) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lastLoginDate.setDate(lastLoginDate.getDate() + inactivityPeriodDays);
|
||||
|
||||
if (lastLoginDate <= new Date()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
isLDAPSet: function() {
|
||||
if (LDAP_DEFAULTS && LDAP_DEFAULTS.url && LDAP_DEFAULTS.port) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
checkResetTokenIsExpired: function(token, expireTimeInMinute) {
|
||||
var user = Meteor.users.findOne({"services.password.reset.token": token});
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
var tokenCreatedTime = user.services.password.reset.when;
|
||||
if (!tokenCreatedTime) {
|
||||
return;
|
||||
}
|
||||
// Token will be expired if created time is over 30 min as default
|
||||
tokenCreatedTime.setTime(tokenCreatedTime.getTime() + expireTimeInMinute*60000);
|
||||
if (tokenCreatedTime < new Date()) {
|
||||
// Remove reset token
|
||||
Meteor.users.update({_id: user._id}, {$unset: {'services.password.reset': 1}});
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
||||
checkResetPasswordExistence: function(hashedPassword, token) {
|
||||
var user = Meteor.users.findOne({"services.password.reset.token": token});
|
||||
if (!user) {
|
||||
return;
|
||||
}
|
||||
var previousPasswords = user.previousPasswords;
|
||||
if (!previousPasswords) {
|
||||
return;
|
||||
}
|
||||
for(var i=0; i< previousPasswords.length; i++) {
|
||||
var recordedHashedPassword = previousPasswords[i].hashedPassword;
|
||||
if (recordedHashedPassword == hashedPassword) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
},
|
||||
|
||||
});
|
||||
@@ -1,215 +0,0 @@
|
||||
// var nightwatch = require('nightwatch');
|
||||
|
||||
describe('clinical:active-entry', function () {
|
||||
var server = meteor();
|
||||
var client = browser(server);
|
||||
|
||||
// before(function () {
|
||||
// return server.promise(function (resolve){
|
||||
// Meteor.users.find().forEach(function(user){
|
||||
// Meteor.users.remove({_id: user._id});
|
||||
// }, function(){
|
||||
// resolve();
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
// afterEach(function (){
|
||||
// return client.promise(function (resolve){
|
||||
// Meteor.logout(function(error, result){
|
||||
// resolve();
|
||||
// });
|
||||
// });
|
||||
// });
|
||||
|
||||
|
||||
it("ActiveEntry object should be loaded on client and server", function () {
|
||||
return server.execute(function () {
|
||||
expect(ActiveEntry.isAbc()).to.equal('abc');
|
||||
}).then(function (data){
|
||||
return client.execute(function (a) {
|
||||
expect(ActiveEntry.isAbc()).to.equal('abc');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("Error messages should be empty by default", function () {
|
||||
return client.execute(function () {
|
||||
expect(ActiveEntry.errorMessages.get('signInError')).to.equal(false);
|
||||
});
|
||||
});
|
||||
|
||||
// ActiveEntry.verifyEmail
|
||||
it('Email validation confirms it is a properly formatted email.', function () {
|
||||
return client.execute(function (a) {
|
||||
ActiveEntry.verifyEmail('janedoe@somewhere.com');
|
||||
expect(ActiveEntry.successMessages.get('email')).to.equal("Email present");
|
||||
|
||||
ActiveEntry.verifyEmail('');
|
||||
expect(ActiveEntry.errorMessages.get('email')).to.equal("Email is required");
|
||||
|
||||
ActiveEntry.verifyEmail('janedoe.somewhere.com');
|
||||
expect(ActiveEntry.errorMessages.get('email')).to.equal("Email is poorly formatted");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ActiveEntry.verifyPassword
|
||||
it('Password validation confirms it is a properly formatted password.', function () {
|
||||
return client.execute(function (a) {
|
||||
ActiveEntry.verifyPassword('');
|
||||
expect(ActiveEntry.errorMessages.get('password')).to.equal("Password is required");
|
||||
|
||||
ActiveEntry.verifyPassword('kittens');
|
||||
expect(ActiveEntry.errorMessages.get('password')).to.equal(Session.get('passwordWarning'));
|
||||
|
||||
ActiveEntry.verifyPassword('K1tt#ns123');
|
||||
expect(ActiveEntry.successMessages.get('password')).to.equal("Password present");
|
||||
});
|
||||
});
|
||||
|
||||
// ActiveEntry.verifyConfirmPassword
|
||||
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");
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
// ActiveEntry.verifyFullName
|
||||
it('Fullname validation confirms that at least a first and last name are entered.', function () {
|
||||
return client.execute(function (a) {
|
||||
ActiveEntry.verifyFullName('');
|
||||
expect(ActiveEntry.errorMessages.get('fullName')).to.equal("Name is required");
|
||||
|
||||
ActiveEntry.verifyFullName('Jane');
|
||||
expect(ActiveEntry.errorMessages.get('fullName')).to.equal("Name is probably not complete");
|
||||
|
||||
ActiveEntry.verifyFullName('Jane Doe');
|
||||
expect(ActiveEntry.successMessages.get('fullName')).to.equal("Name present");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// // 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', 'Janedoe123', 'Janedoe123', '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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
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'});
|
||||
expect(user).to.be.ok;
|
||||
expect(user.fullName()).to.equal('Jane Doe');
|
||||
expect(user.givenName()).to.equal('Jane');
|
||||
expect(user.familyName()).to.equal('Doe');
|
||||
}).then(function (){
|
||||
// client.wait(500, "until user is logged out", function(){
|
||||
// Meteor.logout();
|
||||
// });
|
||||
return client.promise(function (resolve){
|
||||
Meteor.logout(function (error, result){
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
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', 'Janed*e123');
|
||||
}).then(function (){
|
||||
client.wait(3000, "for user to sign in", function (){
|
||||
expect(Meteor.userId()).to.exist;
|
||||
});
|
||||
});
|
||||
});
|
||||
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', 'Janed*e123');
|
||||
}).then(function (){
|
||||
client.wait(3000, "for user to sign in", function (){
|
||||
expect(Meteor.userId()).to.exist;
|
||||
ActiveEntry.signOut('janedoe@test.org');
|
||||
}).then(function (){
|
||||
expect(Meteor.userId()).to.not.exist;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
// it("config should be able to change company logo", function () {
|
||||
//
|
||||
// });
|
||||
// it("config should be able to change entry message text", function () {
|
||||
//
|
||||
// });
|
||||
|
||||
// it("new user should be able to register on desktop", function () {
|
||||
// client.location = "/sign-in";
|
||||
//
|
||||
// client.execute(function () {
|
||||
// expect($('#entrySignIn')).to.exist();
|
||||
// expect($('#signInPageEmailInput')).to.exist();
|
||||
// expect($('#signInPagePasswordInput')).to.exist();
|
||||
// expect($('#signInToAppButton')).to.exist();
|
||||
// }).setValue('#signInPageEmailInput', 'house@test.org')
|
||||
// .setValue('#signInPagePasswordInput', 'house@test.org')
|
||||
// .click('#signInToAppButton').execute(function(){
|
||||
// expect($('#entrySignIn')).to.exist();
|
||||
// expect($('#signInPageEmailInput')).to.exist();
|
||||
// expect($('#signInPagePasswordInput')).to.exist();
|
||||
// expect($('#signInToAppButton')).to.exist();
|
||||
// // expect($('#entrySignIn')).to.not.exist();
|
||||
// // expect($('#signInPageEmailInput')).to.not.exist();
|
||||
// // expect($('#signInPagePasswordInput')).to.not.exist();
|
||||
// // expect($('#signInToAppButton')).to.not.exist();
|
||||
// });
|
||||
// // .then(function(data){
|
||||
// // return server.execute(3000, 'until the account is created', function () {
|
||||
// // expect(Meteor.users.find().count()).to.be.above(20);
|
||||
// // });
|
||||
// // });
|
||||
// });
|
||||
|
||||
|
||||
});
|
||||
@@ -1,22 +0,0 @@
|
||||
// async version calls method on the server
|
||||
exports.command = function () {
|
||||
var client = this;
|
||||
|
||||
this
|
||||
.timeoutsAsyncScript(5000)
|
||||
.executeAsync(function (data, meteorCallback) {
|
||||
//return HipaaLogger.logEventObject(data);
|
||||
Meteor.call("dropCollaborations", data, function (meteorError, meteorResult) {
|
||||
var response = (meteorError ? {
|
||||
error: meteorError
|
||||
} : {
|
||||
result: meteorResult
|
||||
});
|
||||
meteorCallback(response);
|
||||
});
|
||||
}, [], function (result) {
|
||||
console.log("result.value", result.value);
|
||||
client.assert.ok(result.value);
|
||||
}).pause(1000);
|
||||
return this;
|
||||
};
|
||||
@@ -1,222 +0,0 @@
|
||||
// when new user fills out form and registers, new user should get created
|
||||
// when user signs in with username and password, should redirect to home page
|
||||
// newly created user record should have role
|
||||
// newly created user record should have profile
|
||||
// newly created user record should have full, preferred, and family name
|
||||
// user object should return first name
|
||||
// user object should return last name
|
||||
// user should be able to request reset password email
|
||||
// user should be able to request be able to create new account
|
||||
// guest should be notified if username already exists
|
||||
// guest should be notified if passwords do not match
|
||||
// guest should be notified if email is not correctly formatted
|
||||
// new user should be able to register on desktop
|
||||
// new user should be able to register on tablet
|
||||
// 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
|
||||
|
||||
|
||||
|
||||
module.exports = {
|
||||
tags: ['users', 'entry'],
|
||||
before: function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignUp")
|
||||
.initializeUsers()
|
||||
.resizeWindow(1600, 1200);
|
||||
},
|
||||
"new user should be able to register on desktop": function (client) {
|
||||
client
|
||||
.verify.elementPresent("#entrySignUp")
|
||||
.verify.elementPresent("#signUpPageTitle")
|
||||
.verify.elementPresent("#signUpPageMessage")
|
||||
.verify.elementPresent("#signUpPageEmailInput")
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.verify.elementPresent("#signUpPageJoinNowButton")
|
||||
.verify.elementPresent("#signUpPageSignInButton");
|
||||
},
|
||||
"company logo should display on sign-in page": function (client) {
|
||||
client
|
||||
.verify.elementPresent("#entrySignUp")
|
||||
.verify.elementPresent("#entryAppLogo");
|
||||
},
|
||||
"user should be able to request be able to create new account": function (client) {
|
||||
client.verify.elementPresent("#signUpPageEmailInput")
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.verify.elementPresent("#signUpPageJoinNowButton");
|
||||
},
|
||||
"guest should be notified if password is insecure": function (client) {
|
||||
client
|
||||
.clearValue("input")
|
||||
.verify.elementPresent("#signUpPagePasswordInput")
|
||||
.verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid gray')
|
||||
.setValue("#signUpPagePasswordInput", "jan")
|
||||
.verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid rgb(242, 222, 222)')
|
||||
.setValue("#signUpPagePasswordInput", "iceD*e123")
|
||||
.verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid green')
|
||||
|
||||
.verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid gray')
|
||||
.setValue("#signUpPagePasswordConfirmInput", "ja")
|
||||
.verify.cssProperty('#signUpPagePasswordConfirmInput', 'border',
|
||||
'1px solid rgb(242, 222, 222)')
|
||||
.clearValue("#signUpPagePasswordConfirmInput")
|
||||
.setValue("#signUpPagePasswordConfirmInput", "Janiced*e123")
|
||||
.verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid green');
|
||||
},
|
||||
"guest should be notified if passwords do not match": function (client) {
|
||||
client
|
||||
.clearValue("#signUpPagePasswordConfirmInput")
|
||||
.clearValue("#signUpPagePasswordInput")
|
||||
.resetEntry()
|
||||
.pause(500)
|
||||
.verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid gray')
|
||||
.verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid gray')
|
||||
.setValue("#signUpPagePasswordInput", "Janiced*e123")
|
||||
.verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid green')
|
||||
.verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid gray')
|
||||
.setValue("#signUpPagePasswordConfirmInput", "Janiced*e123")
|
||||
.verify.cssProperty('#signUpPagePasswordInput', 'border', '1px solid green')
|
||||
.verify.cssProperty('#signUpPagePasswordConfirmInput', 'border', '1px solid green');
|
||||
},
|
||||
"guest should be notified if email is not correctly formatted": function (client) {
|
||||
client
|
||||
.clearValue("#signUpPageEmailInput")
|
||||
.resetEntry()
|
||||
.verify.elementPresent("#signUpPageEmailInput")
|
||||
.verify.cssProperty('#signUpPageEmailInput', 'border', '1px solid gray')
|
||||
.setValue("#signUpPageEmailInput", "janicedoe")
|
||||
.verify.cssProperty('#signUpPageEmailInput', 'border', '1px solid rgb(242, 222, 222)')
|
||||
.setValue("#signUpPageEmailInput", "@symptomatic.io")
|
||||
.verify.cssProperty('#signUpPageEmailInput', 'border', '1px solid green');
|
||||
},
|
||||
"when new user fills out form and registers, new user should get created": function (client) {
|
||||
client
|
||||
.verify.elementPresent("#entrySignUp")
|
||||
|
||||
.clearValue("#signUpPagePasswordConfirmInput")
|
||||
.clearValue("#signUpPagePasswordInput")
|
||||
.clearValue("#signUpPageFullNameInput")
|
||||
.clearValue("#signUpPageEmailInput")
|
||||
.resetEntry()
|
||||
|
||||
.setValue("#signUpPageFullNameInput", "Janice Doe")
|
||||
.setValue("#signUpPageEmailInput", "janicedoe@symptomatic.io")
|
||||
.setValue("#signUpPagePasswordInput", "Janiced*e123")
|
||||
.setValue("#signUpPagePasswordConfirmInput", "Janiced*e123")
|
||||
|
||||
.click("#signUpPageJoinNowButton").pause(1000)
|
||||
|
||||
.verify.containsText("#usernameLink", "janicedoe@symptomatic.io");
|
||||
},
|
||||
"user should be able to signout": function (client) {
|
||||
client
|
||||
.verify.elementPresent("#logoutButton")
|
||||
.click("#logoutButton").pause(300)
|
||||
.verify.containsText("#usernameLink", "Sign In");
|
||||
},
|
||||
"user should be able to request reset password email": function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignIn")
|
||||
.verify.elementPresent("#forgotPasswordButton")
|
||||
.click("#forgotPasswordButton")
|
||||
.verify.elementPresent("#forgotPassword")
|
||||
.verify.elementPresent("#signInPageEmailInput")
|
||||
.verify.elementPresent("#sendReminderButton");
|
||||
},
|
||||
"existing user should be able to sign in on desktop": function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignIn")
|
||||
.resizeWindow(1600, 1200)
|
||||
.verify.containsText("#usernameLink", "Sign In")
|
||||
.signIn("janicedoe@symptomatic.io", "Janiced*e123").pause(500)
|
||||
.verify.containsText("#usernameLink", "janicedoe@symptomatic.io")
|
||||
.click("#logoutButton").pause(200)
|
||||
.verify.containsText("#usernameLink", "Sign In");
|
||||
},
|
||||
"existing user should be able to sign in on tablet": function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignIn")
|
||||
.resizeWindow(1024, 768)
|
||||
.verify.containsText("#usernameLink", "Sign In")
|
||||
.signIn("janicedoe@symptomatic.io", "Janiced*e123").pause(500)
|
||||
.verify.containsText("#usernameLink", "janicedoe@symptomatic.io")
|
||||
.click("#logoutButton").pause(200)
|
||||
.verify.containsText("#usernameLink", "Sign In");
|
||||
},
|
||||
"existing user should be able to sign in on phone": function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignIn")
|
||||
.resizeWindow(320, 960)
|
||||
// .verify.containsText("#usernameLink", "Sign In")
|
||||
.signIn("janicedoe@symptomatic.io", "Janiced*e123").pause(500)
|
||||
.click("#navbarHeader").pause(300)
|
||||
.verify.containsText("#usernameLink", "janicedoe@symptomatic.io")
|
||||
.click("#logoutButton").pause(200)
|
||||
.verify.containsText("#usernameLink", "Sign In");
|
||||
},
|
||||
"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)
|
||||
.signIn("alice@symptomatic.io", "alice123").pause(500)
|
||||
.verify.containsText("#signInPageMessage", "User not found [403]")
|
||||
.verify.cssProperty("#signInPageMessage", "color", "rgba(169, 68, 66, 1)")
|
||||
.verify.cssProperty("#signInPageMessage", "background-color", "rgba(242, 222, 222, 1)")
|
||||
.verify.cssProperty("#signInPageMessage", "border-color", "rgb(235, 204, 209)");
|
||||
},
|
||||
"anonymous guest should be notified if email already exists": function (client) {
|
||||
client
|
||||
.url("http://localhost:3000/entrySignUp")
|
||||
.resizeWindow(1024, 768)
|
||||
.signUp("janicedoe@symptomatic.io", "Janiced*e123").pause(500)
|
||||
.click("#signUpPageJoinNowButton").pause(1000)
|
||||
.verify.elementPresent("#signUpPageMessage")
|
||||
.verify.containsText("#signUpPageMessage", "Email already exists. [403]");
|
||||
},
|
||||
after: function (client) {
|
||||
client
|
||||
.dropEntryUsers()
|
||||
.end();
|
||||
}
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
.build*
|
||||
@@ -1,13 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.10"
|
||||
#sudo: required
|
||||
|
||||
sudo: required
|
||||
|
||||
env:
|
||||
global:
|
||||
- METEOR_ENV=development
|
||||
|
||||
before_install:
|
||||
- "curl -L http://git.io/ejPSng | /bin/sh"
|
||||
@@ -1,9 +0,0 @@
|
||||
|
||||
#### v2.3.7
|
||||
|
||||
* Updated to use clinical:router
|
||||
|
||||
#### v2.4.0
|
||||
|
||||
* clinical:hipaa-loger extracted from package
|
||||
* HipaaLogger and HipaaLog removed
|
||||
@@ -1,71 +0,0 @@
|
||||
clinical:hipaa-audit-log
|
||||
====================================================
|
||||
|
||||
HIPAA logging and audit features for Meteor Apps built with Clinical UI.
|
||||
|
||||

|
||||
|
||||
====================================================
|
||||
#### Installation
|
||||
|
||||
The HIPAA audit log is now split into two packages: one for the logging, and one for the UI. Please see [``clinical:hipaa-logger``](https://github.com/clinical-meteor/hipaa-logger) for the logging portion.
|
||||
|
||||
````
|
||||
meteor add clinical:hipaa-audit-log
|
||||
meteor add clinical:hipaa-logger
|
||||
````
|
||||
|
||||
====================================================
|
||||
#### URL Routes
|
||||
|
||||
Navigate to the audit log via the default route:
|
||||
|
||||
````js
|
||||
Router.go('/audit');
|
||||
````
|
||||
|
||||
====================================================
|
||||
#### Provided Templates
|
||||
|
||||
Three templates are provided by this package:
|
||||
|
||||
````html
|
||||
{{>hipaaAuditLog}}
|
||||
{{>hipaaRibbon}}
|
||||
{{>hipaaLogPage}}
|
||||
````
|
||||
|
||||
====================================================
|
||||
#### Styling and Classes
|
||||
|
||||
You can adjust the styling of the audit log through the configuration object. The following example shows how to style the audit log with Bootstrap controls.
|
||||
|
||||
````js
|
||||
HipaaAuditLog.configure({
|
||||
classes: {
|
||||
input: "form-control squee",
|
||||
select: "form-control",
|
||||
ribbon: ""
|
||||
},
|
||||
highlightColor: "#006289"
|
||||
});
|
||||
````
|
||||
|
||||
|
||||
====================================================
|
||||
#### StarryNight/Nightwatch API - Provides
|
||||
|
||||
````js
|
||||
// component API calls
|
||||
reviewHipaaAuditLogPage()
|
||||
hipaaLogEntryContains(rowIndex, hipaaEvent)
|
||||
|
||||
// actions
|
||||
logHipaaEvent(hipaaEvent, timeout)
|
||||
````
|
||||
|
||||
|
||||
------------------------
|
||||
### License
|
||||
|
||||

|
||||
@@ -1,188 +0,0 @@
|
||||
<template name="hipaaAuditLog">
|
||||
<ul id="hipaaAuditLog" class="list-group">
|
||||
{{#each hipaaAudit}}
|
||||
{{> hipaaEntry}}
|
||||
{{/each}}
|
||||
</ul>
|
||||
</template>
|
||||
|
||||
<template name="hipaaEntry">
|
||||
{{#if logMessageType 'init'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-gears fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> initialized HIPAA Audit Log.
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'access'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-database fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> accessed record(s) <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'create'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-plus-circle fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
{{#if hasPatientInfo}}
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> created record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName" style="{{getHighlightColor}}">{{getPatientName}}</span>.
|
||||
{{else}}
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> created record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'modify'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-pencil fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
{{#if hasPatientInfo}}
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> modified record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName" style="{{getHighlightColor}}">{{getPatientName}}</span>.
|
||||
{{else}}
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> modified record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'clone'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-code-fork fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> cloned record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'delete'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-minus-circle fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> deleted record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'denied'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-warning fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> was denied access to record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'viewed'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-eye fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
{{#if hasPatientInfo}}
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> viewed record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection, regarding patient <span class="patientName" style="{{getHighlightColor}}">{{getPatientName}}</span>.
|
||||
{{else}}
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> viewed record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
{{/if}}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'publish'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-rss fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> published record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'unpublish'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-circle-o fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> unpublished record <span class="mongoRecordId" style="{{getHighlightColor}}">{{getRecordId}}</span> in the <span class="collectionName" style="{{getHighlightColor}}">{{getCollectionName}}</span> collection.
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
|
||||
{{#if logMessageType 'error'}}
|
||||
<li class="hipaaAuditItem list-group-item">
|
||||
<div class="media">
|
||||
<div class="media-icon">
|
||||
<i class="fa fa-bomb fa-2x"></i>
|
||||
</div>
|
||||
<div class="media-body">
|
||||
<span class="small gray">{{entryTimestamp}}</span><br>
|
||||
<span class="userName" style="{{getHighlightColor}}">{{userName}}</span> received a data access error while performing an action!<br>
|
||||
<span class="error">{{getErrorMessage}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
{{/if}}
|
||||
|
||||
</template>
|
||||
@@ -1,160 +0,0 @@
|
||||
//Hipaa = new Meteor.Collection("hipaa");
|
||||
|
||||
Session.setDefault("hipaaSearchFilter", '');
|
||||
Session.setDefault("hipaaTypeFilter", '');
|
||||
|
||||
// search window defaults to seven days in the past and one day in the future
|
||||
Session.setDefault("beginDateFilter", new Date(moment().subtract(7, "days")).toISOString());
|
||||
Session.setDefault("endDateFilter", new Date(moment().add(1, "days")).toISOString());
|
||||
|
||||
|
||||
|
||||
|
||||
Template.hipaaAuditLog.onRendered(function () {
|
||||
Session.set("ribbonWidth", $('#hipaaRibbon').width());
|
||||
});
|
||||
|
||||
Template.hipaaAuditLog.helpers({
|
||||
getHipaaSearchFilter: function () {
|
||||
return Session.get('hipaaSearchFilter');
|
||||
},
|
||||
hipaaAudit: function () {
|
||||
// return HipaaLog.find();
|
||||
return HipaaLog.find({
|
||||
$or: [
|
||||
{
|
||||
userName: {
|
||||
$regex: Session.get('hipaaSearchFilter'),
|
||||
$options: 'i'
|
||||
}
|
||||
},
|
||||
{
|
||||
patientName: {
|
||||
$regex: Session.get('hipaaSearchFilter'),
|
||||
$options: 'i'
|
||||
}
|
||||
},
|
||||
{
|
||||
recordId: {
|
||||
$regex: Session.get('hipaaSearchFilter'),
|
||||
$options: 'i'
|
||||
}
|
||||
},
|
||||
{
|
||||
collectionName: {
|
||||
$regex: Session.get('hipaaSearchFilter'),
|
||||
$options: 'i'
|
||||
}
|
||||
}
|
||||
],
|
||||
eventType: {
|
||||
$regex: Session.get("hipaaTypeFilter"),
|
||||
$options: 'i'
|
||||
},
|
||||
timestamp: {
|
||||
$lte: new Date(Session.get('endDateFilter')),
|
||||
$gte: new Date(Session.get('beginDateFilter'))
|
||||
}
|
||||
}, {
|
||||
sort: {
|
||||
timestamp: -1
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Template.hipaaAuditLog.events({
|
||||
"keyup #hipaaSearchFilter": function (event, template) {
|
||||
Session.set("hipaaSearchFilter", $('#hipaaSearchFilter').val());
|
||||
},
|
||||
"click .userName": function(event, template) {
|
||||
var userName = $(event.currentTarget).text();
|
||||
Session.set('hipaaSearchFilter', userName);
|
||||
},
|
||||
"click .patientName": function(event, template) {
|
||||
var patientName = $(event.currentTarget).text();
|
||||
var patientNameRegex = patientName.replace(/[!@#$%^&*()+=\-[\]\\';,./{}|":<>?~_]/g, "\\$&");
|
||||
Session.set('hipaaSearchFilter', patientNameRegex);
|
||||
},
|
||||
"click .mongoRecordId": function(event, template) {
|
||||
var mongoRecordId = $(event.currentTarget).text();
|
||||
Session.set('hipaaSearchFilter', mongoRecordId);
|
||||
},
|
||||
"click .collectionName": function(event, template) {
|
||||
var collectionName = $(event.currentTarget).text();
|
||||
Session.set('hipaaSearchFilter', collectionName);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
// HIPAA EVENT RECORD
|
||||
|
||||
Template.hipaaEntry.helpers({
|
||||
getHighlightColor: function () {
|
||||
var hipaaAuditLog = Session.get('HipaaAuditLogConfig');
|
||||
if (hipaaAuditLog) {
|
||||
return "color:" + hipaaAuditLog.highlightColor;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
getUserName: function () {
|
||||
if (this.userName) {
|
||||
return this.userName;
|
||||
} else {
|
||||
return "---";
|
||||
}
|
||||
},
|
||||
getPatientName: function () {
|
||||
if (this.patientName) {
|
||||
return this.patientName;
|
||||
} else {
|
||||
return "---";
|
||||
}
|
||||
},
|
||||
hasPatientInfo: function () {
|
||||
if (this.patientName) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
getErrorMessage: function () {
|
||||
if (this.message) {
|
||||
return this.message;
|
||||
} else {
|
||||
return "---";
|
||||
}
|
||||
},
|
||||
getCollectionName: function () {
|
||||
if (this.collectionName) {
|
||||
return this.collectionName;
|
||||
} else {
|
||||
return "---";
|
||||
}
|
||||
},
|
||||
getRecordId: function () {
|
||||
if (this.recordId) {
|
||||
return this.recordId;
|
||||
} else {
|
||||
return "---";
|
||||
}
|
||||
},
|
||||
entryTimestamp: function () {
|
||||
return moment(this.timestamp).format("YYYY, MMM DD, hh:mm A");
|
||||
},
|
||||
entryTime: function () {
|
||||
return moment(this.timestamp).format("HH:MM A");
|
||||
},
|
||||
entryDate: function () {
|
||||
return moment(this.timestamp).format("YYYY, MMM DD");
|
||||
},
|
||||
logMessageType: function (eventType) {
|
||||
if (this.eventType === eventType) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,54 +0,0 @@
|
||||
#hipaaAuditLog{
|
||||
color: #fff;
|
||||
width: 100%;
|
||||
|
||||
.hipaaAuditItem {
|
||||
border: none;
|
||||
background-color: black;
|
||||
list-style: none;
|
||||
padding: 10px;
|
||||
line-height: 25px;
|
||||
|
||||
// There's a CSS rule on ohif-user-management that's changing the .hipaaAuditItem border style (w/ !important)
|
||||
&:first-child {
|
||||
border-top: none !important;
|
||||
}
|
||||
|
||||
&:not(:first-child) {
|
||||
border-top: 1px solid #436270;
|
||||
}
|
||||
|
||||
border-bottom: 1px solid #436270;
|
||||
|
||||
&:nth-child(even) {
|
||||
background-color: #151a1f;
|
||||
}
|
||||
|
||||
&:hover, &:active, &.active {
|
||||
background-color: #2c363f;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.item-icon {
|
||||
top: 12px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.media-icon {
|
||||
float: left;
|
||||
top: 12px;
|
||||
width: 40px;
|
||||
text-align: center;
|
||||
position: relative;
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.gray{
|
||||
color: gray;
|
||||
}
|
||||
|
||||
.userName, .patientName, .mongoRecordId, .collectionName{
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
<template name="hipaaCloseButton">
|
||||
<div class="close-btn">
|
||||
{{#if header}}
|
||||
<button type="button" class="close">
|
||||
<span>×</span>
|
||||
</button>
|
||||
{{else}}
|
||||
<button type="button" class="btn btn-default">
|
||||
Close
|
||||
</button>
|
||||
{{/if}}
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,12 +0,0 @@
|
||||
Template.hipaaCloseButton.events({
|
||||
'click button': function() {
|
||||
var history = window.history;
|
||||
|
||||
if(history.length > 0) {
|
||||
history.go(-1);
|
||||
}
|
||||
else {
|
||||
window.location = '/'
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1,44 +0,0 @@
|
||||
@tableTextSecondaryColor: #91b9cd;
|
||||
|
||||
.close-btn {
|
||||
text-align: right;
|
||||
padding: 5px 5px 0;
|
||||
|
||||
&:before,
|
||||
&:after {
|
||||
display: table;
|
||||
content: " ";
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.close {
|
||||
color: @tableTextSecondaryColor;
|
||||
opacity: 1;
|
||||
|
||||
&.close:hover, &.close:focus {
|
||||
color: #fff;
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-default {
|
||||
margin-bottom: 5px;
|
||||
margin-right: 5%;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1161px) {
|
||||
.close-btn {
|
||||
.btn-default {
|
||||
margin-right: 3%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 991px) {
|
||||
.close-btn {
|
||||
.btn-default {
|
||||
margin-right: 1%;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
<template name="hipaaLogPage">
|
||||
<div id="hipaaLogPage" class="page">
|
||||
|
||||
<div class="hipaaHeader clearfix">
|
||||
<div class="header pull-left">
|
||||
Audit Log
|
||||
</div>
|
||||
<div class="pull-right">
|
||||
{{> hipaaCloseButton header="true" }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{> hipaaRibbon }}
|
||||
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
{{> hipaaAuditLog}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#if hasCloseButtons}}
|
||||
{{> hipaaCloseButton }}
|
||||
{{/if}}
|
||||
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,17 +0,0 @@
|
||||
Router.route("/audit", {
|
||||
name:"hipaaAuditLogRoute",
|
||||
template:"hipaaLogPage"
|
||||
});
|
||||
|
||||
|
||||
Template.hipaaLogPage.helpers({
|
||||
hasCloseButtons: function() {
|
||||
var hipaaAuditLog = Session.get('HipaaAuditLogConfig');
|
||||
return hipaaAuditLog && hipaaAuditLog.closeButton;
|
||||
}
|
||||
});
|
||||
|
||||
// We probably don't need this, but the subscription in subscriptions.js doesn't seem to be working?
|
||||
Template.hipaaLogPage.onCreated(function() {
|
||||
this.subscribe('HipaaLog');
|
||||
})
|
||||
@@ -1,52 +0,0 @@
|
||||
@tableTextSecondaryColor: #91b9cd;
|
||||
|
||||
@hipaaHeaderHeight: 75px;
|
||||
@hipaaHeaderBgColor: #151a1f;
|
||||
|
||||
#hipaaLogPage {
|
||||
background-color: #000;
|
||||
|
||||
.hipaaHeader {
|
||||
background-color: @hipaaHeaderBgColor;
|
||||
height: @hipaaHeaderHeight;
|
||||
margin-bottom: 2px;
|
||||
padding: 0 20px;
|
||||
|
||||
& > div {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.header {
|
||||
font-size: 22px;
|
||||
font-weight: 300;
|
||||
color: @tableTextSecondaryColor;
|
||||
line-height: @hipaaHeaderHeight;
|
||||
}
|
||||
}
|
||||
|
||||
.container {
|
||||
margin: 0;
|
||||
padding: 0 5%;
|
||||
width: 100%;
|
||||
|
||||
& > div.row {
|
||||
margin: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 1161px) {
|
||||
#hipaaLogPage {
|
||||
.container {
|
||||
padding: 0 3%;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 991px) {
|
||||
#hipaaLogPage {
|
||||
.container {
|
||||
padding: 0 1%;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<template name="hipaaRibbon">
|
||||
<div id="hipaaRibbon" class="row {{getRibbonClass}}">
|
||||
<div class="filter col-xs-12 col-sm-4 col-md-6">
|
||||
<span>User</span>
|
||||
<div class="btn-group">
|
||||
<input type="text" name="hipaaSearchFilter" id="hipaaSearchFilter" value="{{getHipaaSearchFilter}}" class="form-control">
|
||||
<span id="searchClear" class="glyphicon glyphicon-remove-circle"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="filter col-xs-4 col-sm-3 col-md-2 text-center">
|
||||
<span>Begin Date</span>
|
||||
<input type="date" id="beginDateInput" class="{{getInputClass}}" value="{{getBeginDate}}">
|
||||
</div>
|
||||
<div class="filter col-xs-4 col-sm-3 col-md-2 text-center">
|
||||
<span>End Date</span>
|
||||
<input type="date" id="endDateInput" class="{{getInputClass}}" value="{{getEndDate}}">
|
||||
</div>
|
||||
<div class="filter col-xs-4 col-sm-2 text-center">
|
||||
<span>Action</span>
|
||||
<select id="actionFilter" name="actionFilter" class="{{getSelectClass}}">
|
||||
<option id="filterCreatedButton" value="create">Created</option>
|
||||
<option id="filterModifiedButton" value="modify">Modified</option>
|
||||
<option id="filterViewedButton" value="viewed">Viewed</option>
|
||||
<option id="filterAllButton" selected value="">All</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,75 +0,0 @@
|
||||
Template.hipaaRibbon.events({
|
||||
'keyup #hipaaSearchFilter': function () {
|
||||
Session.set("hipaaSearchFilter", $('#hipaaSearchFilter').val());
|
||||
},
|
||||
"change #beginDateInput": function (event, template) {
|
||||
Session.set("beginDateFilter", $('#beginDateInput').val() + "T00:00:00.000Z");
|
||||
},
|
||||
"change #endDateInput": function (event, template) {
|
||||
Session.set("endDateFilter", $('#endDateInput').val() + "T00:00:00.000Z");
|
||||
},
|
||||
'change #actionFilter': function(e) {
|
||||
var actionType = e.currentTarget.value;
|
||||
Session.set("hipaaTypeFilter", actionType);
|
||||
},
|
||||
'click #filterCreatedButton': function () {
|
||||
Session.set("hipaaTypeFilter", 'create');
|
||||
},
|
||||
'click #filterModifiedButton': function () {
|
||||
Session.set("hipaaTypeFilter", 'modify');
|
||||
},
|
||||
'click #filterViewedButton': function () {
|
||||
Session.set("hipaaTypeFilter", 'viewed');
|
||||
},
|
||||
'click #filterAllButton': function () {
|
||||
Session.set("hipaaTypeFilter", '');
|
||||
},
|
||||
'click #searchClear': function() {
|
||||
Session.set("hipaaSearchFilter", '');
|
||||
}
|
||||
});
|
||||
|
||||
var ribbonBreakPoint = 760;
|
||||
|
||||
|
||||
Meteor.startup(function(){
|
||||
$(window).resize(function(evt) {
|
||||
Session.set("ribbonWidth", $('#hipaaRibbon').width());
|
||||
});
|
||||
});
|
||||
|
||||
Template.hipaaRibbon.helpers({
|
||||
getRibbonClass: function () {
|
||||
var hipaaAuditLog = Session.get('HipaaAuditLogConfig');
|
||||
if (hipaaAuditLog && hipaaAuditLog.classes) {
|
||||
return hipaaAuditLog.classes.ribbon;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
getSelectClass: function () {
|
||||
var hipaaAuditLog = Session.get('HipaaAuditLogConfig');
|
||||
if (hipaaAuditLog && hipaaAuditLog.classes) {
|
||||
return hipaaAuditLog.classes.select;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
getInputClass: function () {
|
||||
var hipaaAuditLog = Session.get('HipaaAuditLogConfig');
|
||||
if (hipaaAuditLog && hipaaAuditLog.classes) {
|
||||
return hipaaAuditLog.classes.input;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
},
|
||||
getHipaaSearchFilter: function () {
|
||||
return Session.get('hipaaSearchFilter');
|
||||
},
|
||||
getBeginDate: function () {
|
||||
return moment(Session.get("beginDateFilter")).format("YYYY-MM-DD");
|
||||
},
|
||||
getEndDate: function () {
|
||||
return moment(Session.get("endDateFilter")).format("YYYY-MM-DD");
|
||||
}
|
||||
});
|
||||
@@ -1,113 +0,0 @@
|
||||
@tableTextPrimaryColor: white;
|
||||
@tableTextSecondaryColor: #91b9cd;
|
||||
|
||||
@inputBackgroundColor: #2c363f;
|
||||
@inputPlaceholderColor: lightgray;
|
||||
|
||||
@hipaaRibbonBgColor: #151a1f;
|
||||
|
||||
#hipaaRibbon {
|
||||
background-color: @hipaaRibbonBgColor;
|
||||
border-bottom: solid 1px #6fbde2;
|
||||
color: @tableTextPrimaryColor;
|
||||
margin: 0 0 2px;
|
||||
padding: 20px 5%;
|
||||
|
||||
.filter {
|
||||
> span {
|
||||
font-size: 15px;
|
||||
display: block;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
min-height: 70px;
|
||||
|
||||
&:first-child {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
&:not(:last-child) {
|
||||
padding-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
input[type="date"] {
|
||||
padding-left: 10px;
|
||||
}
|
||||
|
||||
select {
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
input, select {
|
||||
height: 40px;
|
||||
padding: 20px;
|
||||
cursor: pointer;
|
||||
border: none;
|
||||
background-color: @inputBackgroundColor;
|
||||
color: @inputPlaceholderColor;
|
||||
font-size: 10pt;
|
||||
font-weight: normal;
|
||||
width: 100%;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
|
||||
transition: all 0.15s ease;
|
||||
-webkit-transition: all 0.15s ease;
|
||||
|
||||
&:active, &:hover {
|
||||
background-color: @inputBackgroundColor;
|
||||
}
|
||||
}
|
||||
|
||||
.btn-group {
|
||||
width: 100%;
|
||||
|
||||
#hipaaSearchFilter{
|
||||
padding-right: 35px;
|
||||
}
|
||||
|
||||
#searchClear {
|
||||
position: absolute;
|
||||
right: 14px;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
height: 14px;
|
||||
margin: auto;
|
||||
font-size: 14px;
|
||||
cursor: pointer;
|
||||
color: #ccc;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@media only screen and (max-width: 1161px) {
|
||||
#hipaaRibbon {
|
||||
padding: 20px 3%;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 991px) {
|
||||
#hipaaRibbon {
|
||||
padding: 20px 1%;
|
||||
}
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 767px) {
|
||||
#hipaaRibbon {
|
||||
.filter {
|
||||
&:first-child {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
&:nth-child(2) {
|
||||
padding-left: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
Meteor.subscribe('HipaaLog');
|
||||
@@ -1,20 +0,0 @@
|
||||
HipaaAuditLog = {
|
||||
configure: function (configObject) {
|
||||
if (Meteor.isClient) {
|
||||
Session.set('HipaaAuditLogConfig', configObject);
|
||||
}
|
||||
//console.log("HipaaAuditLogConfig.configObject", configObject);
|
||||
}
|
||||
}
|
||||
|
||||
if (Meteor.isClient) {
|
||||
Session.setDefault('HipaaAuditLogConfig', {
|
||||
classes: {
|
||||
input: "",
|
||||
select: "",
|
||||
ribbon: ""
|
||||
},
|
||||
highlightColor: "",
|
||||
closeButton: false
|
||||
});
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
Package.describe({
|
||||
summary: "HIPAA audit log for ClinicalFramework.",
|
||||
version: "2.4.2",
|
||||
git: "http://github.com/clinical-meteor/clinical-hipaa-audit-log.git",
|
||||
name: "clinical:hipaa-audit-log"
|
||||
});
|
||||
|
||||
Package.on_use(function (api) {
|
||||
api.versionsFrom('1.1.0.3');
|
||||
|
||||
api.use('meteor-platform');
|
||||
|
||||
api.use('mrt:moment@2.8.1', 'client');
|
||||
api.use('grove:less@0.1.1', 'client');
|
||||
|
||||
api.use('clinical:router@2.0.19');
|
||||
api.use('clinical:fonts@1.0.0', 'client');
|
||||
api.use('clinical:auto-resizing@0.1.2', 'client');
|
||||
api.use('clinical:hipaa-logger@1.0.0');
|
||||
|
||||
api.imply('clinical:hipaa-logger');
|
||||
|
||||
api.addFiles('lib/HipaaAuditLog.js');
|
||||
|
||||
api.addFiles('server/initialize.js', "server");
|
||||
api.addFiles('server/publication.js', "server");
|
||||
|
||||
api.addFiles('components/hipaaRibbon/hipaaRibbon.html', "client");
|
||||
api.addFiles('components/hipaaRibbon/hipaaRibbon.js', "client");
|
||||
api.addFiles('components/hipaaRibbon/hipaaRibbon.less', "client");
|
||||
|
||||
api.addFiles('components/hipaaAuditLog/hipaaAuditLog.html', "client");
|
||||
api.addFiles('components/hipaaAuditLog/hipaaAuditLog.js', "client");
|
||||
api.addFiles('components/hipaaAuditLog/hipaaAuditLog.less', "client");
|
||||
|
||||
api.addFiles('components/hipaaLogPage/hipaaLogPage.html', "client");
|
||||
api.addFiles('components/hipaaLogPage/hipaaLogPage.js', "client");
|
||||
api.addFiles('components/hipaaLogPage/hipaaLogPage.less', "client");
|
||||
|
||||
api.addFiles('components/hipaaCloseButton/hipaaCloseButton.html', "client");
|
||||
api.addFiles('components/hipaaCloseButton/hipaaCloseButton.js', "client");
|
||||
api.addFiles('components/hipaaCloseButton/hipaaCloseButton.less', "client");
|
||||
|
||||
api.export('HipaaAuditLog');
|
||||
});
|
||||
|
||||
|
||||
|
||||
Package.onTest(function (api) {
|
||||
api.use('tinytest');
|
||||
|
||||
api.use('meteor-platform');
|
||||
api.use('clinical:router@2.0.19', 'client');
|
||||
api.use('mrt:moment@2.8.1', 'client');
|
||||
api.use('grove:less@0.1.1', 'client');
|
||||
|
||||
api.use('clinical:verification');
|
||||
api.use('clinical:fonts@1.0.0');
|
||||
api.use('clinical:hipaa-audit-log');
|
||||
api.use('clinical:hipaa-logger@1.0.0');
|
||||
|
||||
api.addFiles('tests/tinytest/audit-log-tests.js');
|
||||
});
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 304 KiB |
@@ -1,26 +0,0 @@
|
||||
Meteor.methods({
|
||||
initializeDemoLog:function (){
|
||||
console.log('initializeDemoLog');
|
||||
|
||||
// hipaaEvent, userId, userName, collectionName, recordId, patientId, patientName, message
|
||||
HipaaLogger.logEvent("init", Meteor.userId(), "Ada Lovelace");
|
||||
|
||||
HipaaLogger.logEvent("create", Meteor.userId(), "Ada Lovelace", "Users", Random.id(), Random.id(), "John Doe");
|
||||
|
||||
HipaaLogger.logEvent("viewed", Meteor.userId(), "Mary Shelley", "Users", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("create", Meteor.userId(), "Florence Nightingale", "Vitals", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("viewed", Meteor.userId(), "Florence Nightingale", "Medications", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("create", Meteor.userId(), "Florence Nightingale", "Medications", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("denied", Meteor.userId(), "Kurt Vonnegut", "MedicationPlans", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("create", Meteor.userId(), "Florence Nightingale", "Vitals", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("viewed", Meteor.userId(), "Florence Nightingale", "MedicationPlans", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("modify", Meteor.userId(), "Florence Nightingale", "MedicationPlans", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("viewed", Meteor.userId(), "Edward Doisy", "Users", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("clone", Meteor.userId(), "Edward Doisy", "MedicationPlans", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("publish", Meteor.userId(), "Edward Doisy", "MedicationPlans", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("unpublish", Meteor.userId(), "Edward Doisy", "MedicationPlans", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("delete", Meteor.userId(), "Ada Lovelace", "MedicationPlans", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("viewed", Meteor.userId(), "Florence Nightingale", "Vitals", Random.id(), Random.id(), "John Doe");
|
||||
HipaaLogger.logEvent("create", Meteor.userId(), "Florence Nightingale", "Vitals", Random.id(), Random.id(), "John Doe");
|
||||
}
|
||||
});
|
||||
@@ -1,4 +0,0 @@
|
||||
|
||||
Meteor.publish('HipaaLog', function () {
|
||||
return HipaaLog.find();
|
||||
});
|
||||
@@ -1,72 +0,0 @@
|
||||
|
||||
describe('clinical:hipaa-audit-log', function () {
|
||||
var server = meteor();
|
||||
var client = browser(server);
|
||||
|
||||
// beforeEach(function () {
|
||||
// server.execute(function () {
|
||||
//
|
||||
// }).then(function (value){
|
||||
//
|
||||
// });
|
||||
// });
|
||||
// afterEach(function () {
|
||||
// server.execute(function () {
|
||||
//
|
||||
// });
|
||||
// });
|
||||
|
||||
it('HipaaLogger should exist on the client', function () {
|
||||
return client.execute(function () {
|
||||
expect(HipaaLogger).to.exist;
|
||||
});
|
||||
});
|
||||
|
||||
it('HipaaLogger should exist on the server', function () {
|
||||
return server.execute(function () {
|
||||
expect(HipaaLogger).to.exist;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it("HipaaLogger can log events on the client", function () {
|
||||
return client.execute(function () {
|
||||
HipaaLogger.logEvent({
|
||||
eventType: "modified",
|
||||
userId: "janedoe",
|
||||
userName: "Jane Doe",
|
||||
collectionName: "Medications",
|
||||
recordId: "123",
|
||||
patientId: "123",
|
||||
patientName: "abc"
|
||||
});
|
||||
return HipaaLog.findOne();
|
||||
}).then(function (eventRecord){
|
||||
server.wait(500, "", function (){
|
||||
expect(eventRecord).to.exist;
|
||||
expect(eventRecord.userId).to.equal("janedoe");
|
||||
expect(eventRecord.userName).to.equal("Jane Doe");
|
||||
});
|
||||
});
|
||||
});
|
||||
it("HipaaLogger can log events on the server", function () {
|
||||
return server.execute(function () {
|
||||
HipaaLogger.logEvent({
|
||||
eventType: "modified",
|
||||
userId: "janedoe",
|
||||
userName: "Jane Doe",
|
||||
collectionName: "Medications",
|
||||
recordId: "123",
|
||||
patientId: "123",
|
||||
patientName: "abc"
|
||||
});
|
||||
|
||||
var eventRecord = HipaaLog.findOne();
|
||||
|
||||
expect(eventRecord).to.exist;
|
||||
expect(eventRecord.userId).to.equal("janedoe");
|
||||
expect(eventRecord.userName).to.equal("Jane Doe");
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
-20
@@ -1,20 +0,0 @@
|
||||
|
||||
|
||||
|
||||
exports.command = function(rowIndex, hipaaEvent) {
|
||||
this
|
||||
.verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ")")
|
||||
|
||||
if(hipaaEvent.type === "create"){
|
||||
this
|
||||
.verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ") .userName", hipaaEvent.userName)
|
||||
.verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ") .recordId", hipaaEvent.recordId)
|
||||
.verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ") .collectionName", hipaaEvent.collectionName)
|
||||
|
||||
if(hipaaEvent.patientName){
|
||||
this.verify.elementPresent("#hipaaAuditLog .hipaaAuditItem:nth-child(" + rowIndex + ") .patientName", hipaaEvent.patientName)
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
|
||||
|
||||
exports.command = function() {
|
||||
this
|
||||
.verify.elementPresent("#hipaaLogPage")
|
||||
.verify.elementPresent("#hipaaAuditLog")
|
||||
|
||||
return this;
|
||||
};
|
||||
@@ -1,41 +0,0 @@
|
||||
|
||||
|
||||
|
||||
|
||||
// syncrhonous version; doesn't work well
|
||||
/*exports.command = function(hipaaEvent, timeout) {
|
||||
var client = this;
|
||||
this
|
||||
.execute(function(data){
|
||||
return HipaaLogger.logEventObject(data);
|
||||
}, [hipaaEvent], function(result){
|
||||
console.log("result.value", result.value);
|
||||
client.assert.ok(result.value);
|
||||
}).pause(1000)
|
||||
return this;
|
||||
};*/
|
||||
|
||||
|
||||
|
||||
|
||||
// async version calls method on the server
|
||||
exports.command = function(hipaaEvent, timeout) {
|
||||
var client = this;
|
||||
if (!timeout) {
|
||||
timeout = 5000;
|
||||
}
|
||||
|
||||
this
|
||||
.timeoutsAsyncScript(timeout)
|
||||
.executeAsync(function(data, meteorCallback){
|
||||
//return HipaaLogger.logEventObject(data);
|
||||
Meteor.call('logHipaaEvent', data, function(meteorError, meteorResult){
|
||||
var response = (meteorError ? { error: meteorError } : { result: meteorResult });
|
||||
meteorCallback(response);
|
||||
})
|
||||
}, [hipaaEvent], function(result){
|
||||
console.log("result.value", result.value);
|
||||
client.assert.ok(result.value);
|
||||
}).pause(1000)
|
||||
return this;
|
||||
};
|
||||
@@ -1,25 +0,0 @@
|
||||
describe('clinical:hipaa-audit-log', function () {
|
||||
|
||||
describe('user interface', function () {
|
||||
it.client('displays an audit log', function () {
|
||||
|
||||
});
|
||||
it.client('has a search button', function () {
|
||||
|
||||
});
|
||||
it.client('has filter buttons', function () {
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('server functionality', function () {
|
||||
it.client('logs hipaa events to a HIPAA collection', function () {
|
||||
|
||||
});
|
||||
|
||||
it.client('doesnt allow users to delete or modify events', function () {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
@@ -1,20 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013 Chris Lindley
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -1,58 +0,0 @@
|
||||
# zuuk:stale-session
|
||||
|
||||
Stale session and session timeout handling for [meteorjs](http://www.meteor.com/).
|
||||
|
||||
## Quick Start
|
||||
|
||||
```sh
|
||||
$ meteor add zuuk:stale-session
|
||||
```
|
||||
|
||||
## Key Concepts
|
||||
|
||||
When a user logs in to a meteor application, they may gain access to privileged information and functionality. If they neglect to log off, another user of the same computer can effectively impersonate that user and gains the same rights. As it currently stands, (meteor 0.6.6.3), login tokens remain valid for eternity so this creates a large window of opportunity for impersonators.
|
||||
|
||||
This package is designed to detect a user's inactivity and automatically log them off after a configurable amount of time thereby reducing the size of this window to just the inactivity delay.
|
||||
|
||||
It is possible to configure both the timeout and the events that consitute activity.
|
||||
|
||||
The user will be logged off whether the browser window remains open or not.
|
||||
|
||||
The user is logged off by the server and disabling javascript in the browser (kind of pointless in meteor!) would not prevent automatic log off.
|
||||
|
||||
The user can be logged on multiple times on multiple devices and activity in any one of those devices will keep the sessions alive.
|
||||
|
||||
The plugin uses a heartbeat that is configurable but defaulted to ensure that the server is not inundated with heartbeats from clients in systems with many concurrent users.
|
||||
|
||||
## Configuration
|
||||
|
||||
Configuration is via `Meteor.settings.public`.
|
||||
|
||||
- `staleSessionInactivityTimeout` - the amount of time (in ms) after which, if no activity is noticed, a session will be considered stale - default 30 minutes.
|
||||
- `staleSessionPurgeInterval` - interval (in ms) at which stale sessions are purged i.e. found and forcibly logged out - default 1 minute.
|
||||
- `staleSessionHeartbeatInterval` - interval (in ms) at which activity heartbeats are sent up to the server - default every 3 minutes.
|
||||
- `staleSessionActivityEvents` - the jquery events which are considered indicator of activity e.g. in an on() call - default `mousemove click keydown`
|
||||
|
||||
You can set these variables in `config/settings.json` and then launch Meteor with `meteor --settings config/settings.json`.
|
||||
|
||||
Example `config/settings.json` file:
|
||||
|
||||
```json
|
||||
{
|
||||
"public": {
|
||||
"staleSessionInactivityTimeout": 1800000,
|
||||
"staleSessionHeartbeatInterval": 180000,
|
||||
"staleSessionPurgeInterval": 60000,
|
||||
"staleSessionActivityEvents": "mousemove click keydown"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
## Background
|
||||
|
||||
A meteor project I was working on at [ZUUK](http://www.zuuk.com/), required user sessions to timeout after a period of inactivity. Meteor itself doesn't currently (0.6.6.3) support this out of the box and, though there were several plugins already available on [Atmosphere](https://atmosphere.meteor.com/), none of them worked reliably for me so I was forced to create my own for the project. I owe those other packages a great deal of gratitude as this package is effectively just taking ideas from them and making them work in a simpler more reliable fashion for my project. I'm putting this back into the community in the hope it will help in the same situation.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
@@ -1,86 +0,0 @@
|
||||
//
|
||||
// Client side activity detection for the session timeout
|
||||
// - depends on jquery
|
||||
//
|
||||
// Meteor settings:
|
||||
// - staleSessionHeartbeatInterval: interval (in ms) at which activity heartbeats are sent up to the server
|
||||
// - staleSessionActivityEvents: the jquery events which are considered indicator of activity e.g. in an on() call.
|
||||
//
|
||||
var heartbeatInterval = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionHeartbeatInterval || (3*60*1000); // 3mins
|
||||
var activityEvents = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionActivityEvents || 'mousemove click keydown';
|
||||
var inactivityTimeout = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionInactivityTimeout || (30*60*1000); // 30mins
|
||||
|
||||
var dialogTimeout = Meteor.settings && Meteor.settings.public && Meteor.settings.public.dialogTimeout || (30*1000); // 30secs
|
||||
var showCountdownDialog = Meteor.settings && Meteor.settings.public && Meteor.settings.public.showCountdownDialog || false;
|
||||
var countdownHeartbeatInterval = (heartbeatInterval < dialogTimeout)? heartbeatInterval : dialogTimeout;
|
||||
|
||||
var activityDetected = false;
|
||||
var lastActivityDetectedTime = new Date();
|
||||
var dialogIsOpen = false;
|
||||
|
||||
Meteor.startup(function() {
|
||||
|
||||
//
|
||||
// periodically send a heartbeat if activity has been detected within the interval
|
||||
//
|
||||
if (showCountdownDialog) {
|
||||
Meteor.setInterval(function() {
|
||||
if (Meteor.userId()) {
|
||||
if (activityDetected) {
|
||||
Meteor.call('heartbeat', function(error, heartbeatTime) {
|
||||
lastActivityDetectedTime = heartbeatTime;
|
||||
activityDetected = false;
|
||||
// Event to close dialog
|
||||
$.event.trigger('TriggerCloseTimeoutCountdownDialog');
|
||||
dialogIsOpen = false;
|
||||
});
|
||||
|
||||
} else {
|
||||
var overdueTimestamp = new Date().getTime() - lastActivityDetectedTime;
|
||||
// Ignore min differences
|
||||
overdueTimestamp = overdueTimestamp - (overdueTimestamp % 1000);
|
||||
console.log(overdueTimestamp);
|
||||
var startTime = inactivityTimeout - dialogTimeout;
|
||||
var nextIntervalTime = overdueTimestamp + countdownHeartbeatInterval;
|
||||
if (overdueTimestamp <= inactivityTimeout && nextIntervalTime <= inactivityTimeout && nextIntervalTime >= startTime) {
|
||||
if (Math.abs(startTime - overdueTimestamp) <= Math.abs(nextIntervalTime - startTime) && !dialogIsOpen) {
|
||||
// Open dialog
|
||||
var leftTime = Math.round((inactivityTimeout - overdueTimestamp) / 1000);
|
||||
$.event.trigger('TriggerOpenTimeoutCountdownDialog', leftTime);
|
||||
dialogIsOpen = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
// Event to close dialog
|
||||
$.event.trigger('TriggerCloseTimeoutCountdownDialog');
|
||||
dialogIsOpen = false;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
// Event to close dialog
|
||||
$.event.trigger('TriggerCloseTimeoutCountdownDialog');
|
||||
dialogIsOpen = false;
|
||||
}
|
||||
}, countdownHeartbeatInterval);
|
||||
|
||||
} else{
|
||||
|
||||
Meteor.setInterval(function() {
|
||||
if (Meteor.userId() && activityDetected) {
|
||||
Meteor.call('heartbeat');
|
||||
activityDetected = false;
|
||||
}
|
||||
}, heartbeatInterval);
|
||||
}
|
||||
|
||||
//
|
||||
// detect activity and mark it as detected on any of the following events
|
||||
//
|
||||
$(document).on(activityEvents, function() {
|
||||
activityDetected = true;
|
||||
// Event to close dialog
|
||||
$.event.trigger('TriggerCloseTimeoutCountdownDialog');
|
||||
dialogIsOpen = false;
|
||||
});
|
||||
});
|
||||
@@ -1,13 +0,0 @@
|
||||
Package.describe({
|
||||
name: 'zuuk:stale-session',
|
||||
summary: 'Stale session and session timeout handling for meteorjs',
|
||||
git: "https://github.com/lindleycb/meteor-stale-session.git",
|
||||
version: "1.0.8"
|
||||
});
|
||||
|
||||
Package.onUse(function(api) {
|
||||
api.use('accounts-base@1.0.0', ['client','server']);
|
||||
api.use('jquery@1.0.0', 'client');
|
||||
api.addFiles('client.js', 'client');
|
||||
api.addFiles('server.js', 'server');
|
||||
});
|
||||
@@ -1,37 +0,0 @@
|
||||
//
|
||||
// Server side activity detection for the session timeout
|
||||
//
|
||||
// Meteor settings:
|
||||
// - staleSessionInactivityTimeout: the amount of time (in ms) after which, if no activity is noticed, a session will be considered stale
|
||||
// - staleSessionPurgeInterval: interval (in ms) at which stale sessions are purged i.e. found and forcibly logged out
|
||||
//
|
||||
var staleSessionPurgeInterval = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionPurgeInterval || (1*60*1000); // 1min
|
||||
var inactivityTimeout = Meteor.settings && Meteor.settings.public && Meteor.settings.public.staleSessionInactivityTimeout || (30*60*1000); // 30mins
|
||||
|
||||
//
|
||||
// provide a user activity heartbeat method which stamps the user record with a timestamp of the last
|
||||
// received activity heartbeat.
|
||||
//
|
||||
Meteor.methods({
|
||||
heartbeat: function(options) {
|
||||
if (!this.userId) { return; }
|
||||
var user = Meteor.users.findOne(this.userId);
|
||||
if (user) {
|
||||
var heartbeatTime = new Date();
|
||||
Meteor.users.update(user._id, {$set: {heartbeat: heartbeatTime}});
|
||||
return heartbeatTime;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//
|
||||
// periodically purge any stale sessions, removing their login tokens and clearing out the stale heartbeat.
|
||||
//
|
||||
Meteor.setInterval(function() {
|
||||
var now = new Date(), overdueTimestamp = new Date(now-inactivityTimeout);
|
||||
Meteor.users.update({heartbeat: {$lt: overdueTimestamp}},
|
||||
{$set: {'services.resume.loginTokens': []},
|
||||
$unset: {heartbeat:1}},
|
||||
{multi: true});
|
||||
}, staleSessionPurgeInterval);
|
||||
@@ -12,7 +12,6 @@ Package.onUse(function(api) {
|
||||
api.versionsFrom('1.7');
|
||||
|
||||
api.use('ecmascript');
|
||||
api.use('standard-app-packages');
|
||||
api.use('jquery');
|
||||
api.use('stylus');
|
||||
api.use('underscore');
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
OHIF.lesiontracker = {};
|
||||
@@ -1,40 +0,0 @@
|
||||
import { OHIF } from 'meteor/ohif:core';
|
||||
|
||||
import { measurementTools } from './measurementTools';
|
||||
import { retrieveMeasurements, storeMeasurements, retrieveTimepoints, storeTimepoints, removeTimepoint, updateTimepoint, disassociateStudy } from './dataExchange';
|
||||
import { validateMeasurements } from './dataValidation';
|
||||
import { FieldLesionLocation, FieldLesionLocationResponse } from 'meteor/ohif:lesiontracker/both/schema/fields';
|
||||
|
||||
OHIF.measurements.MeasurementApi.setConfiguration({
|
||||
measurementTools,
|
||||
newLesions: [{
|
||||
id: 'newTargets',
|
||||
name: 'New Targets',
|
||||
toolGroupId: 'targets'
|
||||
}, {
|
||||
id: 'newNonTargets',
|
||||
name: 'New Non-Targets',
|
||||
toolGroupId: 'nonTargets'
|
||||
}],
|
||||
dataExchange: {
|
||||
retrieve: retrieveMeasurements,
|
||||
store: storeMeasurements
|
||||
},
|
||||
dataValidation: {
|
||||
validation: validateMeasurements
|
||||
},
|
||||
schema: {
|
||||
nonTargetLocation: FieldLesionLocation,
|
||||
nonTargetResponse: FieldLesionLocationResponse
|
||||
}
|
||||
});
|
||||
|
||||
OHIF.measurements.TimepointApi.setConfiguration({
|
||||
dataExchange: {
|
||||
retrieve: retrieveTimepoints,
|
||||
store: storeTimepoints,
|
||||
remove: removeTimepoint,
|
||||
update: updateTimepoint,
|
||||
disassociate: disassociateStudy
|
||||
}
|
||||
});
|
||||
@@ -1,113 +0,0 @@
|
||||
import { measurementTools } from './measurementTools';
|
||||
|
||||
export const retrieveMeasurements = (patientId, timepointIds) => {
|
||||
console.log('retrieveMeasurements');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('retrieveMeasurements', patientId, timepointIds, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
console.log(response);
|
||||
|
||||
/*measurementTools.forEach(tool => {
|
||||
console.log('Retrieving tool: ' + tool.id);
|
||||
});*/
|
||||
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const storeMeasurements = (measurementData, timepointIds) => {
|
||||
console.log('storeMeasurements');
|
||||
|
||||
// Here is where we should do any required data transformation and API calls
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('storeMeasurements', measurementData, timepointIds, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const retrieveTimepoints = filter => {
|
||||
console.log('retrieveTimepoints');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('retrieveTimepoints', filter, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const storeTimepoints = (timepointData) => {
|
||||
console.log('storeTimepoints');
|
||||
console.log(timepointData);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('storeTimepoints', timepointData, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const updateTimepoint = (timepointData, query) => {
|
||||
console.log('updateTimepoint');
|
||||
console.log(timepointData);
|
||||
console.log(query);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('updateTimepoint', timepointData, query, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const removeTimepoint = timepointId => {
|
||||
console.log('removeTimepoint');
|
||||
console.log(timepointId);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('removeTimepoint', timepointId, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
export const disassociateStudy = (timepointIds, studyInstanceUid) => {
|
||||
console.log('disassociateStudy');
|
||||
console.log(timepointIds);
|
||||
console.log(studyInstanceUid);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.call('disassociateStudy', timepointIds, studyInstanceUid, (error, response) => {
|
||||
if (error) {
|
||||
reject(error);
|
||||
} else {
|
||||
resolve(response);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
@@ -1,3 +0,0 @@
|
||||
export const validateMeasurements = () => {
|
||||
console.log('validateMeasurements');
|
||||
};
|
||||
@@ -1,4 +0,0 @@
|
||||
import './measurementTools.js';
|
||||
import './dataExchange.js';
|
||||
import './dataValidation.js';
|
||||
import './configuration.js';
|
||||
@@ -1,9 +0,0 @@
|
||||
import { targets } from './toolGroups/targets';
|
||||
import { nonTargets } from './toolGroups/nonTargets';
|
||||
import { temp } from './toolGroups/temp';
|
||||
|
||||
export const measurementTools = [
|
||||
targets,
|
||||
nonTargets,
|
||||
temp
|
||||
];
|
||||
@@ -1,29 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
export const ToolGroupBaseSchema = new SimpleSchema({
|
||||
toolId: {
|
||||
type: String,
|
||||
label: 'Tool ID',
|
||||
optional: true
|
||||
},
|
||||
toolItemId: {
|
||||
type: String,
|
||||
label: 'Tool Item ID',
|
||||
optional: true
|
||||
},
|
||||
createdAt: {
|
||||
type: Date
|
||||
},
|
||||
studyInstanceUid: {
|
||||
type: String,
|
||||
label: 'Study Instance UID'
|
||||
},
|
||||
timepointId: {
|
||||
type: String,
|
||||
label: 'Timepoint ID'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
}
|
||||
});
|
||||
@@ -1,9 +0,0 @@
|
||||
import { ToolGroupBaseSchema } from './baseSchema';
|
||||
import { nonTarget } from '../tools/nonTarget';
|
||||
|
||||
export const nonTargets = {
|
||||
id: 'nonTargets',
|
||||
name: 'Non-Targets',
|
||||
childTools: [nonTarget],
|
||||
schema: ToolGroupBaseSchema
|
||||
};
|
||||
@@ -1,11 +0,0 @@
|
||||
import { ToolGroupBaseSchema } from './baseSchema';
|
||||
import { bidirectional } from '../tools/bidirectional';
|
||||
import { targetCR } from '../tools/targetCR';
|
||||
import { targetUN } from '../tools/targetUN';
|
||||
|
||||
export const targets = {
|
||||
id: 'targets',
|
||||
name: 'Targets',
|
||||
childTools: [bidirectional, targetCR, targetUN],
|
||||
schema: ToolGroupBaseSchema
|
||||
};
|
||||
@@ -1,10 +0,0 @@
|
||||
import { ToolGroupBaseSchema } from './baseSchema';
|
||||
import { length } from '../tools/length';
|
||||
import { ellipse } from '../tools/ellipse';
|
||||
|
||||
export const temp = {
|
||||
id: 'temp',
|
||||
name: 'Temporary',
|
||||
childTools: [length, ellipse],
|
||||
schema: ToolGroupBaseSchema
|
||||
};
|
||||
@@ -1,98 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const { CornerstoneHandleSchema } = MeasurementSchemaTypes;
|
||||
|
||||
const BidirectionalHandleSchema = new SimpleSchema([CornerstoneHandleSchema, {
|
||||
selected: {
|
||||
type: Boolean,
|
||||
label: 'Selected',
|
||||
optional: true,
|
||||
defaultValue: false
|
||||
}
|
||||
}]);
|
||||
|
||||
const BidirectionalHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: BidirectionalHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: BidirectionalHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
perpendicularStart: {
|
||||
type: BidirectionalHandleSchema,
|
||||
label: 'Perpendicular Start'
|
||||
},
|
||||
perpendicularEnd: {
|
||||
type: BidirectionalHandleSchema,
|
||||
label: 'Perpendicular End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
},
|
||||
});
|
||||
|
||||
const BidirectionalSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: BidirectionalHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
optional: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
label: 'Description',
|
||||
optional: true
|
||||
},
|
||||
longestDiameter: {
|
||||
type: Number,
|
||||
label: 'Longest Diameter',
|
||||
decimal: true
|
||||
},
|
||||
shortestDiameter: {
|
||||
type: Number,
|
||||
label: 'Shortest Diameter',
|
||||
decimal: true
|
||||
},
|
||||
isSplitLesion: {
|
||||
type: Boolean,
|
||||
label: 'Is Split Lesion',
|
||||
optional: true,
|
||||
defaultValue: false
|
||||
}
|
||||
}]);
|
||||
|
||||
const displayFunction = data => {
|
||||
if (data.shortestDiameter) {
|
||||
// TODO: Make this check criteria again to see if we should display shortest x longest
|
||||
return data.longestDiameter + ' x ' + data.shortestDiameter;
|
||||
}
|
||||
|
||||
return data.longestDiameter;
|
||||
};
|
||||
|
||||
export const bidirectional = {
|
||||
id: 'bidirectional',
|
||||
name: 'Target',
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'bidirectional',
|
||||
schema: BidirectionalSchema,
|
||||
options: {
|
||||
measurementTable: {
|
||||
displayFunction
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const EllipseHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
},
|
||||
});
|
||||
|
||||
const EllipseSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: EllipseHandlesSchema,
|
||||
label: 'Handles'
|
||||
}
|
||||
}]);
|
||||
|
||||
export const ellipse = {
|
||||
id: 'ellipticalRoi',
|
||||
name: 'Ellipse',
|
||||
toolGroup: 'temp',
|
||||
cornerstoneToolType: 'ellipticalRoi',
|
||||
schema: EllipseSchema
|
||||
};
|
||||
@@ -1,34 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const LengthHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
}
|
||||
});
|
||||
|
||||
const LengthSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: LengthHandlesSchema,
|
||||
label: 'Handles'
|
||||
}
|
||||
}]);
|
||||
|
||||
export const length = {
|
||||
id: 'length',
|
||||
name: 'Length',
|
||||
toolGroup: 'temp',
|
||||
cornerstoneToolType: 'length',
|
||||
schema: LengthSchema
|
||||
};
|
||||
@@ -1,61 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const NonTargetHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
}
|
||||
});
|
||||
|
||||
const NonTargetSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: NonTargetHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
response: {
|
||||
type: String,
|
||||
label: 'Response',
|
||||
optional: true // Optional because it is added after initial drawing, via a callback
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
optional: true
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
label: 'Description',
|
||||
optional: true
|
||||
}
|
||||
}]);
|
||||
|
||||
export const nonTarget = {
|
||||
id: 'nonTarget',
|
||||
name: 'Non-Target',
|
||||
toolGroup: 'nonTargets',
|
||||
cornerstoneToolType: 'nonTarget',
|
||||
schema: NonTargetSchema,
|
||||
options: {
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,61 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const TargetCRHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
}
|
||||
});
|
||||
|
||||
const TargetCRSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: TargetCRHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
optional: true
|
||||
},
|
||||
response: {
|
||||
type: String,
|
||||
label: 'Response',
|
||||
optional: true // Optional because it is added after initial drawing, via a callback
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
label: 'Description',
|
||||
optional: true
|
||||
}
|
||||
}]);
|
||||
|
||||
export const targetCR = {
|
||||
id: 'targetCR',
|
||||
name: 'CR Target',
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'targetCR',
|
||||
schema: TargetCRSchema,
|
||||
options: {
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,61 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
import { MeasurementSchemaTypes } from 'meteor/ohif:measurements/both/schema/measurements';
|
||||
|
||||
const CornerstoneHandleSchema = MeasurementSchemaTypes.CornerstoneHandleSchema;
|
||||
|
||||
const TargetUNHandlesSchema = new SimpleSchema({
|
||||
start: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Start'
|
||||
},
|
||||
end: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'End'
|
||||
},
|
||||
textBox: {
|
||||
type: CornerstoneHandleSchema,
|
||||
label: 'Text Box'
|
||||
}
|
||||
});
|
||||
|
||||
const TargetUNSchema = new SimpleSchema([MeasurementSchemaTypes.CornerstoneToolMeasurement, {
|
||||
handles: {
|
||||
type: TargetUNHandlesSchema,
|
||||
label: 'Handles'
|
||||
},
|
||||
measurementNumber: {
|
||||
type: Number,
|
||||
label: 'Measurement Number'
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location',
|
||||
optional: true
|
||||
},
|
||||
response: {
|
||||
type: String,
|
||||
label: 'Response',
|
||||
optional: true // Optional because it is added after initial drawing, via a callback
|
||||
},
|
||||
description: {
|
||||
type: String,
|
||||
label: 'Description',
|
||||
optional: true
|
||||
}
|
||||
}]);
|
||||
|
||||
export const targetUN = {
|
||||
id: 'targetUN',
|
||||
name: 'UN Target',
|
||||
toolGroup: 'targets',
|
||||
cornerstoneToolType: 'targetUN',
|
||||
schema: TargetUNSchema,
|
||||
options: {
|
||||
measurementTable: {
|
||||
displayFunction: data => data.response
|
||||
},
|
||||
caseProgress: {
|
||||
include: true
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,2 +0,0 @@
|
||||
import './base.js';
|
||||
import './configuration';
|
||||
@@ -1,60 +0,0 @@
|
||||
export const FieldLesionLocation = {
|
||||
type: String,
|
||||
label: 'Lesion Location',
|
||||
allowedValues: [
|
||||
'',
|
||||
'Abdominal/Chest Wall',
|
||||
'Adrenal',
|
||||
'Bladder',
|
||||
'Bone',
|
||||
'Brain',
|
||||
'Breast',
|
||||
'Colon',
|
||||
'Esophagus',
|
||||
'Extremities',
|
||||
'Gallbladder',
|
||||
'Kidney',
|
||||
'Liver',
|
||||
'Lung',
|
||||
'Lymph Node',
|
||||
'Mediastinum/Hilum',
|
||||
'Muscle',
|
||||
'Neck',
|
||||
'Other: Soft Tissue',
|
||||
'Ovary',
|
||||
'Pancreas',
|
||||
'Pelvis',
|
||||
'Peritoneum/Omentum',
|
||||
'Prostate',
|
||||
'Retroperitoneum',
|
||||
'Small Bowel',
|
||||
'Spleen',
|
||||
'Stomach',
|
||||
'Subcutaneous'
|
||||
]
|
||||
};
|
||||
|
||||
export const FieldLesionLocationResponse = {
|
||||
type: String,
|
||||
label: 'Lesion Location Response',
|
||||
allowedValues: [
|
||||
'',
|
||||
'CR',
|
||||
'PD',
|
||||
'SD',
|
||||
'Present',
|
||||
'NE',
|
||||
'NN',
|
||||
'EX'
|
||||
],
|
||||
valuesLabels: [
|
||||
'',
|
||||
'CR - Complete response',
|
||||
'PD - Progressive disease',
|
||||
'SD - Stable disease',
|
||||
'Present - Present',
|
||||
'NE - Not Evaluable',
|
||||
'NN - Non-CR/Non-PD',
|
||||
'EX - Excluded from Assessment'
|
||||
]
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
export * from './fields.js';
|
||||
@@ -1,87 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
const LocationSchema = new SimpleSchema({
|
||||
id: {
|
||||
type: String,
|
||||
label: 'Location ID'
|
||||
},
|
||||
location: {
|
||||
type: String,
|
||||
label: 'Location Name'
|
||||
},
|
||||
selected: {
|
||||
type: Boolean,
|
||||
label: 'Selected',
|
||||
defaultValue: false
|
||||
},
|
||||
isNodal: {
|
||||
type: Boolean,
|
||||
label: 'Nodal Location',
|
||||
defaultValue: false
|
||||
}
|
||||
});
|
||||
|
||||
LesionLocations = new Meteor.Collection(null);
|
||||
LesionLocations.attachSchema(LocationSchema);
|
||||
LesionLocations._debugName = 'LesionLocations';
|
||||
|
||||
var organGroups = [
|
||||
'Abdominal/Chest Wall',
|
||||
'Adrenal',
|
||||
'Bladder',
|
||||
'Bone',
|
||||
'Brain',
|
||||
'Breast',
|
||||
'Colon',
|
||||
'Esophagus',
|
||||
'Extremities',
|
||||
'Gallbladder',
|
||||
'Kidney',
|
||||
'Liver',
|
||||
'Lung',
|
||||
'Lymph Node',
|
||||
'Mediastinum/Hilum',
|
||||
'Muscle',
|
||||
'Neck',
|
||||
'Other: Soft Tissue',
|
||||
'Ovary',
|
||||
'Pancreas',
|
||||
'Pelvis',
|
||||
'Peritoneum/Omentum',
|
||||
'Prostate',
|
||||
'Retroperitoneum',
|
||||
'Small Bowel',
|
||||
'Spleen',
|
||||
'Stomach',
|
||||
'Subcutaneous'];
|
||||
|
||||
function nameToID(name) {
|
||||
// http://stackoverflow.com/questions/29258016/remove-special-symbols-and-extra-spaces-and-make-it-camel-case-javascript
|
||||
return name
|
||||
.trim() //might need polyfill if you need to support older browsers
|
||||
.toLowerCase() //lower case everything
|
||||
.replace(/([^A-Z0-9]+)(.)/ig, //match multiple non-letter/numbers followed by any character
|
||||
function(match) {
|
||||
return arguments[2].toUpperCase(); //3rd index is the character we need to transform uppercase
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
organGroups.forEach(function(organGroup) {
|
||||
const id = nameToID(organGroup);
|
||||
|
||||
// Check if the name has 'node' in it, if so, it is nodal
|
||||
let isNodal = false;
|
||||
if (id.toLowerCase().indexOf('node') > -1) {
|
||||
isNodal = true;
|
||||
}
|
||||
|
||||
LesionLocations.insert({
|
||||
id: id,
|
||||
location: organGroup,
|
||||
selected: false,
|
||||
isNodal: isNodal
|
||||
});
|
||||
});
|
||||
|
||||
export { LesionLocations };
|
||||
@@ -1,56 +0,0 @@
|
||||
import { SimpleSchema } from 'meteor/aldeed:simple-schema';
|
||||
|
||||
const ResponseSchema = new SimpleSchema({
|
||||
text: {
|
||||
type: String,
|
||||
label: 'Text'
|
||||
},
|
||||
code: {
|
||||
type: String,
|
||||
label: 'Code'
|
||||
},
|
||||
selected: {
|
||||
type: Boolean,
|
||||
label: 'Selected',
|
||||
defaultValue: false
|
||||
}
|
||||
});
|
||||
|
||||
LocationResponses = new Meteor.Collection(null);
|
||||
LocationResponses.attachSchema(ResponseSchema);
|
||||
LocationResponses._debugName = 'LocationResponses';
|
||||
|
||||
LocationResponses.insert({
|
||||
text: 'Complete response',
|
||||
code: 'CR'
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: 'Progressive disease',
|
||||
code: 'PD'
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: 'Stable disease',
|
||||
code: 'SD'
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: 'Present',
|
||||
code: 'Present'
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: 'Not Evaluable',
|
||||
code: 'NE'
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: 'Non-CR/Non-PD',
|
||||
code: 'NN'
|
||||
});
|
||||
|
||||
LocationResponses.insert({
|
||||
text: 'Excluded from Assessment',
|
||||
code: 'EX'
|
||||
});
|
||||
@@ -1,2 +0,0 @@
|
||||
import './LesionLocations.js';
|
||||
import './LocationResponses.js';
|
||||
-163
@@ -1,163 +0,0 @@
|
||||
import { cornerstone, cornerstoneTools, cornerstoneMath } from 'meteor/ohif:cornerstone';
|
||||
import { toolType } from './definitions';
|
||||
import createNewMeasurement from './createNewMeasurement';
|
||||
import mouseMoveCallback from './mouseMoveCallback';
|
||||
import mouseDownCallback from './mouseDownCallback';
|
||||
import doubleClickCallback from './doubleClickCallback';
|
||||
import updatePerpendicularLineHandles from './updatePerpendicularLineHandles';
|
||||
|
||||
export default function(mouseEventData) {
|
||||
const { element } = mouseEventData;
|
||||
const $element = $(element);
|
||||
|
||||
const imagePlane = cornerstone.metaData.get('imagePlaneModule', mouseEventData.image.imageId);
|
||||
let rowPixelSpacing;
|
||||
let colPixelSpacing;
|
||||
|
||||
if (imagePlane) {
|
||||
rowPixelSpacing = imagePlane.rowPixelSpacing || imagePlane.rowImagePixelSpacing;
|
||||
colPixelSpacing = imagePlane.columnPixelSpacing || imagePlane.colImagePixelSpacing;
|
||||
} else {
|
||||
rowPixelSpacing = mouseEventData.image.rowPixelSpacing;
|
||||
colPixelSpacing = mouseEventData.image.columnPixelSpacing;
|
||||
}
|
||||
|
||||
// LT-29 Disable Target Measurements when pixel spacing is not available
|
||||
if (!rowPixelSpacing || !colPixelSpacing) {
|
||||
return;
|
||||
}
|
||||
|
||||
function doneCallback() {
|
||||
measurementData.active = false;
|
||||
cornerstone.updateImage(element);
|
||||
}
|
||||
|
||||
const measurementData = createNewMeasurement(mouseEventData);
|
||||
measurementData.viewport = cornerstone.getViewport(element);
|
||||
|
||||
const tool = cornerstoneTools[toolType];
|
||||
const config = tool.getConfiguration();
|
||||
const { mouseDownActivateCallback } = tool;
|
||||
|
||||
// associate this data with this imageId so we can render it and manipulate it
|
||||
cornerstoneTools.addToolState(element, toolType, measurementData);
|
||||
|
||||
const disableDefaultHandlers = () => {
|
||||
// since we are dragging to another place to drop the end point, we can just activate
|
||||
// the end point and let the moveHandle move it for us.
|
||||
element.removeEventListener('cornerstonetoolsmousemove', mouseMoveCallback);
|
||||
element.removeEventListener('cornerstonetoolsmousedown', mouseDownCallback);
|
||||
element.removeEventListener('cornerstonetoolsmousedownactivate', mouseDownActivateCallback);
|
||||
element.removeEventListener('cornerstonetoolsmousedoubleclick', doubleClickCallback);
|
||||
};
|
||||
|
||||
disableDefaultHandlers();
|
||||
|
||||
// Update the perpendicular line handles position
|
||||
const updateHandler = event => updatePerpendicularLineHandles(event.detail, measurementData);
|
||||
element.addEventListener('cornerstonetoolsmousedrag', updateHandler);
|
||||
element.addEventListener('cornerstonetoolsmouseup', updateHandler);
|
||||
|
||||
let cancelled = false;
|
||||
const cancelAction = () => {
|
||||
cancelled = true;
|
||||
cornerstoneTools.removeToolState(element, toolType, measurementData);
|
||||
};
|
||||
|
||||
// Add a flag for using Esc to cancel tool placement
|
||||
const keyDownHandler = event => {
|
||||
// If the Esc key was pressed, set the flag to true
|
||||
if (event.which === 27) {
|
||||
cancelAction();
|
||||
}
|
||||
|
||||
// Don't propagate this keydown event so it can't interfere
|
||||
// with anything outside of this tool
|
||||
return false;
|
||||
};
|
||||
|
||||
// Bind a one-time event listener for the Esc key
|
||||
$element.one('keydown', keyDownHandler);
|
||||
|
||||
// Bind a mousedown handler to cancel the measurement if it's zero-sized
|
||||
const mousedownHandler = () => {
|
||||
const { start, end } = measurementData.handles;
|
||||
if (!cornerstoneMath.point.distance(start, end)) {
|
||||
cancelAction();
|
||||
}
|
||||
};
|
||||
|
||||
// Bind a one-time event listener for mouse down
|
||||
$element.one('mousedown', mousedownHandler);
|
||||
|
||||
// Keep the current image and create a handler for new rendered images
|
||||
const currentImage = cornerstone.getImage(element);
|
||||
const currentViewport = cornerstone.getViewport(element);
|
||||
const imageRenderedHandler = () => {
|
||||
const newImage = cornerstone.getImage(element);
|
||||
|
||||
// Check if the rendered image changed during measurement creation and delete it if so
|
||||
if (newImage.imageId !== currentImage.imageId) {
|
||||
cornerstone.displayImage(element, currentImage, currentViewport);
|
||||
cancelAction();
|
||||
cornerstone.displayImage(element, newImage, currentViewport);
|
||||
}
|
||||
};
|
||||
|
||||
// Bind the event listener for image rendering
|
||||
element.addEventListener('cornerstoneimagerendered', imageRenderedHandler);
|
||||
|
||||
// Bind the tool deactivation and enlargement handlers
|
||||
element.addEventListener('cornerstonetoolstooldeactivated', cancelAction);
|
||||
$element.one('ohif.viewer.viewport.toggleEnlargement', cancelAction);
|
||||
|
||||
cornerstone.updateImage(element);
|
||||
|
||||
const timestamp = new Date().getTime();
|
||||
const { end, perpendicularStart } = measurementData.handles;
|
||||
cornerstoneTools.moveNewHandle(mouseEventData, toolType, measurementData, end, () => {
|
||||
const { handles, longestDiameter, shortestDiameter } = measurementData;
|
||||
const hasHandlesOutside = cornerstoneTools.anyHandlesOutsideImage(mouseEventData, handles);
|
||||
const longestDiameterSize = parseFloat(longestDiameter) || 0;
|
||||
const shortestDiameterSize = parseFloat(shortestDiameter) || 0;
|
||||
const isTooSmal = (longestDiameterSize < 1) || (shortestDiameterSize < 1);
|
||||
const isTooFast = (new Date().getTime() - timestamp) < 150;
|
||||
if (cancelled || hasHandlesOutside || isTooSmal || isTooFast) {
|
||||
// delete the measurement
|
||||
measurementData.cancelled = true;
|
||||
cornerstoneTools.removeToolState(element, toolType, measurementData);
|
||||
} else {
|
||||
// Set lesionMeasurementData Session
|
||||
config.getMeasurementLocationCallback(measurementData, mouseEventData, doneCallback);
|
||||
}
|
||||
|
||||
// Unbind the Esc keydown hook
|
||||
$element.off('keydown', keyDownHandler);
|
||||
|
||||
// Unbind the mouse down hook
|
||||
$element.off('mousedown', mousedownHandler);
|
||||
|
||||
// Unbind the event listener for image rendering
|
||||
element.removeEventListener('cornerstoneimagerendered', imageRenderedHandler);
|
||||
|
||||
// Unbind the tool deactivation and enlargement handlers
|
||||
element.removeEventListener('cornerstonetoolstooldeactivated', cancelAction);
|
||||
$element.off('ohif.viewer.viewport.toggleEnlargement', cancelAction);
|
||||
|
||||
// perpendicular line is not connected to long-line
|
||||
perpendicularStart.locked = false;
|
||||
|
||||
// Unbind the handlers to update perpendicular line
|
||||
element.removeEventListener('cornerstonetoolsmousedrag', updateHandler);
|
||||
element.removeEventListener('cornerstonetoolsmouseup', updateHandler);
|
||||
|
||||
// Disable the default handlers and re-enable again
|
||||
disableDefaultHandlers();
|
||||
element.addEventListener('cornerstonetoolsmousemove', mouseMoveCallback);
|
||||
element.addEventListener('cornerstonetoolsmousedown', mouseDownCallback);
|
||||
element.addEventListener('cornerstonetoolsmousedownactivate', mouseDownActivateCallback);
|
||||
element.addEventListener('cornerstonetoolsmousedoubleclick', doubleClickCallback);
|
||||
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
}
|
||||
-59
@@ -1,59 +0,0 @@
|
||||
import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone';
|
||||
import { toolType } from './definitions';
|
||||
import createNewMeasurement from './createNewMeasurement';
|
||||
import updatePerpendicularLineHandles from './updatePerpendicularLineHandles';
|
||||
|
||||
export default function(touchEventData) {
|
||||
const element = { touchEventData };
|
||||
|
||||
// LT-29 Disable Target Measurements when pixel spacing is not available
|
||||
if (!touchEventData.image.rowPixelSpacing || !touchEventData.image.columnPixelSpacing) return;
|
||||
|
||||
const doneCallback = () => {
|
||||
measurementData.active = false;
|
||||
cornerstone.updateImage(element);
|
||||
};
|
||||
|
||||
const measurementData = createNewMeasurement(touchEventData);
|
||||
const { cancelled, handles } = measurementData;
|
||||
const config = cornerstoneTools[toolType].getConfiguration();
|
||||
|
||||
// associate this data with this imageId so we can render it and manipulate it
|
||||
cornerstoneTools.addToolState(element, toolType, measurementData);
|
||||
|
||||
// since we are dragging to another place to drop the end point, we can just activate
|
||||
// the end point and let the moveHandle move it for us.
|
||||
const { touchMoveHandle, tapCallback, touchDownActivateCallback } = cornerstoneTools[toolType];
|
||||
element.removeEventListener('cornerstonetoolstouchdrag', touchMoveHandle);
|
||||
element.removeEventListener('cornerstonetoolstap', tapCallback);
|
||||
element.removeEventListener('cornerstonetoolsdragstartactive', touchDownActivateCallback);
|
||||
|
||||
// Update the perpendicular line handles position
|
||||
const updateHandler = event => updatePerpendicularLineHandles(event.detail, measurementData);
|
||||
element.addEventListener('cornerstonetoolstouchdrag', updateHandler);
|
||||
element.addEventListener('cornerstonetoolstouchend', updateHandler);
|
||||
|
||||
cornerstone.updateImage(element);
|
||||
const { end, perpendicularStart } = handles;
|
||||
cornerstoneTools.moveNewHandleTouch(touchEventData, toolType, measurementData, end, () => {
|
||||
if (cancelled || cornerstoneTools.anyHandlesOutsideImage(touchEventData, handles)) {
|
||||
// delete the measurement
|
||||
cornerstoneTools.removeToolState(element, toolType, measurementData);
|
||||
} else {
|
||||
// Set lesionMeasurementData Session
|
||||
config.getMeasurementLocationCallback(measurementData, touchEventData, doneCallback);
|
||||
}
|
||||
|
||||
// perpendicular line is not connected to long-line
|
||||
perpendicularStart.locked = false;
|
||||
|
||||
// Unbind the handlers to update perpendicular line
|
||||
element.removeEventListener('cornerstonetoolstouchdrag', updateHandler);
|
||||
element.removeEventListener('cornerstonetoolstouchend', updateHandler);
|
||||
|
||||
element.addEventListener('cornerstonetoolstouchdrag', touchMoveHandle);
|
||||
element.addEventListener('cornerstonetoolstap', tapCallback);
|
||||
element.addEventListener('cornerstonetoolsdragstartactive', touchDownActivateCallback);
|
||||
cornerstone.updateImage(element);
|
||||
});
|
||||
}
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
// Calculate the longest and shortest diameters for the given measurementData
|
||||
export default function(eventData, measurementData) {
|
||||
const { rowPixelSpacing, columnPixelSpacing } = eventData.image;
|
||||
const { start, end, perpendicularStart, perpendicularEnd } = measurementData.handles;
|
||||
|
||||
// updatePerpendicularLineHandles(eventData, measurementData);
|
||||
|
||||
// Calculate the long axis length
|
||||
const dx = (start.x - end.x) * (columnPixelSpacing || 1);
|
||||
const dy = (start.y - end.y) * (rowPixelSpacing || 1);
|
||||
let length = Math.sqrt(dx * dx + dy * dy);
|
||||
|
||||
// Calculate the short axis length
|
||||
const wx = (perpendicularStart.x - perpendicularEnd.x) * (columnPixelSpacing || 1);
|
||||
const wy = (perpendicularStart.y - perpendicularEnd.y) * (rowPixelSpacing || 1);
|
||||
let width = Math.sqrt(wx * wx + wy * wy);
|
||||
if (!width) {
|
||||
width = 0;
|
||||
}
|
||||
|
||||
// Length is always longer than width
|
||||
if (width > length) {
|
||||
const tempW = width;
|
||||
const tempL = length;
|
||||
length = tempW;
|
||||
width = tempL;
|
||||
}
|
||||
|
||||
// Set measurement text to show lesion table
|
||||
measurementData.longestDiameter = length.toFixed(1);
|
||||
measurementData.shortestDiameter = width.toFixed(1);
|
||||
}
|
||||
-41
@@ -1,41 +0,0 @@
|
||||
import { toolType } from './definitions';
|
||||
|
||||
const getHandle = (x, y, index, extraAttributes={}) => {
|
||||
return Object.assign({
|
||||
x,
|
||||
y,
|
||||
index,
|
||||
drawnIndependently: false,
|
||||
allowedOutsideImage: false,
|
||||
highlight: true,
|
||||
active: false
|
||||
}, extraAttributes);
|
||||
};
|
||||
|
||||
export default function(mouseEventData) {
|
||||
const { x, y } = mouseEventData.currentPoints.image;
|
||||
// Create the measurement data for this tool with the end handle activated
|
||||
const measurementData = {
|
||||
toolType,
|
||||
isCreating: true,
|
||||
visible: true,
|
||||
active: true,
|
||||
handles: {
|
||||
start: getHandle(x, y, 0),
|
||||
end: getHandle(x, y, 1, { active: true }),
|
||||
perpendicularStart: getHandle(x, y, 2, { locked: true }),
|
||||
perpendicularEnd: getHandle(x, y, 3),
|
||||
textBox: getHandle(x - 50, y - 70, null, {
|
||||
highlight: false,
|
||||
movesIndependently: false,
|
||||
drawnIndependently: true,
|
||||
allowedOutsideImage: true,
|
||||
hasBoundingBox: true
|
||||
})
|
||||
},
|
||||
longestDiameter: 0,
|
||||
shortestDiameter: 0
|
||||
};
|
||||
|
||||
return measurementData;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
const toolType = 'bidirectional';
|
||||
const distanceThreshold = 6;
|
||||
|
||||
export {
|
||||
toolType,
|
||||
distanceThreshold
|
||||
};
|
||||
-49
@@ -1,49 +0,0 @@
|
||||
import { cornerstone, cornerstoneTools } from 'meteor/ohif:cornerstone';
|
||||
import { toolType } from './definitions';
|
||||
import pointNearTool from './pointNearTool';
|
||||
|
||||
export default function (event) {
|
||||
const eventData = event.detail;
|
||||
const { element } = eventData.element;
|
||||
|
||||
function doneCallback(data, deleteTool) {
|
||||
if (deleteTool === true) {
|
||||
cornerstoneTools.removeToolState(element, toolType, data);
|
||||
cornerstone.updateImage(element);
|
||||
}
|
||||
}
|
||||
|
||||
const buttonMask = event.data && event.data.mouseButtonMask;
|
||||
if (buttonMask && !cornerstoneTools.isMouseButtonEnabled(eventData.which, buttonMask)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if the element is enabled and stop here if not
|
||||
try {
|
||||
cornerstone.getEnabledElement(element);
|
||||
} catch (error) {
|
||||
return;
|
||||
}
|
||||
|
||||
const config = cornerstoneTools.bidirectional.getConfiguration();
|
||||
|
||||
const coords = eventData.currentPoints.canvas;
|
||||
const toolData = cornerstoneTools.getToolState(element, toolType);
|
||||
|
||||
// now check to see if there is a handle we can move
|
||||
if (!toolData) return;
|
||||
|
||||
let data;
|
||||
for (let i = 0; i < toolData.data.length; i++) {
|
||||
data = toolData.data[i];
|
||||
if (pointNearTool(element, data, coords)) {
|
||||
data.active = true;
|
||||
cornerstone.updateImage(element);
|
||||
// Allow relabelling via a callback
|
||||
config.changeMeasurementLocationCallback(data, eventData, doneCallback);
|
||||
|
||||
event.stopImmediatePropagation();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loaded 100 of 266 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user