LT-196: Verify user's email on signup

This commit is contained in:
Aysel Afsar committed 2016-02-28 12:58:05 -05:00
1 parent ee8fb5492c
commit 813c68881a
11 files changed
+110 -14

No files matched your search

+1
View File
@@ -52,3 +52,4 @@ aldeed:template-extension@4.0.0
zuuk:stale-session
gilbertwat:bootstrap3-daterangepicker
silentcicero:jszip
email
+2
View File
@@ -25,6 +25,7 @@ if (Meteor.isClient){
});
}
/*
if (Meteor.isServer){
Accounts.emailTemplates.siteName = 'AwesomeSite';
Accounts.emailTemplates.from = 'AwesomeSite Admin <accounts@example.com>';
@@ -42,3 +43,4 @@ if (Meteor.isServer){
//process.env.MAIL_URL = 'smtp://sandboxid.mailgun.org:mypassword@smtp.mailgun.org:587';
});
}
*/
@@ -0,0 +1,8 @@
<template name="emailVerification">
<div id="emailVerification">
<div id="emailVerificationContent">
<h3>Verify Your Email Address</h3>
<p>We need to verify your email address. We've sent an email to <b>{{emailAddress}}</b> to verify your address. Please click the link in your email to continue.</p>
</div>
</div>
</template>
@@ -0,0 +1,5 @@
Template.emailVerification.helpers({
emailAddress: function() {
return Meteor.user().emails[0].address;
}
});
@@ -0,0 +1,15 @@
#emailVerification
#emailVerificationContent
position: absolute
top: 0
bottom: 0
left: 0
right: 0
margin: auto
width: 60%
height: 20%
z-index: 100
border-radius: 5px
padding: 10px 20px 10px 20px
background-color: rgba(255,255,255,1)
outline: none
+7 -4
View File
@@ -263,10 +263,13 @@ Template.viewer.onCreated(function() {
});
// Set active tool for timepoint
dataContext.timepointIds.forEach(function(timepointId) {
var timepoint = Timepoints.findOne({timepointId: timepointId});
setTimepointActiveTool(timepoint);
});
if (dataContext && dataContext.timepointIds) {
dataContext.timepointIds.forEach(function(timepointId) {
var timepoint = Timepoints.findOne({timepointId: timepointId});
setTimepointActiveTool(timepoint);
});
}
}
});
});
+23 -6
View File
@@ -1,5 +1,10 @@
Session.setDefault('ViewerData', {});
// TODO: verifyEmail variable will be removed when mail server is set.
// verifyEmail controls email verification template
// set verifyEmail as false if email server settings are not ready
Session.setDefault('verifyEmail', false);
// Re-add any tab data saved in the Session
Object.keys(ViewerData).forEach(function(contentId) {
var tabData = ViewerData[contentId];
@@ -29,21 +34,33 @@ var routerOptions = {
data: data
};
Router.route('/', function() {
// Check user is logged in
if (!Meteor.user() || !Meteor.userId()) {
this.render('entrySignIn', routerOptions);
if(Meteor.user() && Meteor.userId()) {
if (!Meteor.user().emails[0].verified && Session.get("verifyEmail")) {
this.render('emailVerification', routerOptions);
} else {
this.render('worklist', routerOptions);
}
} else {
this.render('worklist', routerOptions);
this.render('entrySignIn', routerOptions);
}
});
Router.route('/worklist', function() {
// Check user is logged in
if (!Meteor.user() || !Meteor.userId()) {
this.render('entrySignIn', routerOptions);
if(Meteor.user() && Meteor.userId()) {
if (!Meteor.user().emails[0].verified && Session.get("verifyEmail")) {
this.render('emailVerification', routerOptions);
} else {
this.render('worklist', routerOptions);
}
} else {
this.render('worklist', routerOptions);
this.render('entrySignIn', routerOptions);
}
});
+34
View File
@@ -0,0 +1,34 @@
/*Meteor.startup(function () {
// Mail server settings
var username = "";
var password = "";
var server = "";
var port = "";
Accounts.emailTemplates.siteName = 'Lesion Tracker';
Accounts.emailTemplates.from = 'Lesion Tracker Admin <'+username+'>';
process.env.MAIL_URL = 'smtp://' +
encodeURIComponent(username) + ':' +
encodeURIComponent(password) + '@' +
encodeURIComponent(server) + ':' + port;
// Subject line of the email.
Accounts.emailTemplates.verifyEmail.subject = function(user) {
return 'Confirm Your Email Address for Lesion Tracker';
};
// Email text
Accounts.emailTemplates.verifyEmail.text = function(user, url) {
return 'Thank you for registering. Please click on the following link to verify your email address: \r\n' + url;
};
// Send email when account is created
Accounts.config({
sendVerificationEmail: true
});
});
*/