WIP reorganization

This commit is contained in:
Erik Ziegler committed 2018-12-12 09:10:39 +01:00
1 parent 6706dfe634
commit 054e37dfb7
266 files changed
+98 -620

No files matched your search

@@ -0,0 +1,48 @@
<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>
@@ -0,0 +1,100 @@
//==========================================
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);
}
});
@@ -0,0 +1,5 @@
#changePassword{
input{
padding-left: 40px;
}
}
+52
View File
@@ -0,0 +1,52 @@
/**
* @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") + "; ";
});
+169
View File
@@ -0,0 +1,169 @@
// @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%;
// }
// }
}
@@ -0,0 +1,10 @@
exports.command = function () {
this
.execute(function () {
return Meteor.logout();
}).pause(1000);
return this;
};
@@ -0,0 +1,23 @@
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;
};
@@ -0,0 +1,22 @@
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;
};
@@ -0,0 +1,35 @@
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;
};
@@ -0,0 +1,73 @@
<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>
@@ -0,0 +1,205 @@
// 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);
}
}
@@ -0,0 +1,31 @@
#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;
}
}
@@ -0,0 +1,22 @@
// 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;
};
@@ -0,0 +1,11 @@
// resetEntry.js
exports.command = function () {
this
.timeoutsAsyncScript(5000)
.executeAsync(function (data, meteorCallback) {
ActiveEntry.reset();
}, []).pause(1000);
return this;
};
@@ -0,0 +1,37 @@
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;
};
@@ -0,0 +1,31 @@
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;
};
@@ -0,0 +1,64 @@
<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>
@@ -0,0 +1,171 @@
//==================================================================================================
// 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');
}
});
@@ -0,0 +1,12 @@
#entrySignUp{
padding: 40px;
input{
padding-left: 40px !important;
color: black;
}
}
#entrySignUp .progress{
height: 5px;
margin-bottom: 1px
}
@@ -0,0 +1,4 @@
exports.command = function () {
this
.verify.elementPresent("#forgotPassword"); return this;
};
@@ -0,0 +1,30 @@
<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>
@@ -0,0 +1,36 @@
//==========================================
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);
}
});
@@ -0,0 +1,5 @@
#forgotPassword{
input{
padding-left: 40px;
}
}
@@ -0,0 +1,42 @@
<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>
@@ -0,0 +1,67 @@
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);
}
});