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,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;
}
}