LT-196: Add verifyEmail property under public property in settings.json to control emailVerification template
- Add mailServerSettings in settings.json
This commit is contained in:
parent
813c68881a
commit
c5651e7e04
@ -1,9 +1,7 @@
|
|||||||
Session.setDefault('ViewerData', {});
|
Session.setDefault('ViewerData', {});
|
||||||
|
|
||||||
// TODO: verifyEmail variable will be removed when mail server is set.
|
// verifyEmail controls whether emailVerification template will be rendered or not
|
||||||
// verifyEmail controls email verification template
|
var verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false;
|
||||||
// set verifyEmail as false if email server settings are not ready
|
|
||||||
Session.setDefault('verifyEmail', false);
|
|
||||||
|
|
||||||
// Re-add any tab data saved in the Session
|
// Re-add any tab data saved in the Session
|
||||||
Object.keys(ViewerData).forEach(function(contentId) {
|
Object.keys(ViewerData).forEach(function(contentId) {
|
||||||
@ -34,12 +32,10 @@ var routerOptions = {
|
|||||||
data: data
|
data: data
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Router.route('/', function() {
|
Router.route('/', function() {
|
||||||
// Check user is logged in
|
// Check user is logged in
|
||||||
if(Meteor.user() && Meteor.userId()) {
|
if(Meteor.user() && Meteor.userId()) {
|
||||||
if (!Meteor.user().emails[0].verified && Session.get("verifyEmail")) {
|
if (!Meteor.user().emails[0].verified && verifyEmail) {
|
||||||
this.render('emailVerification', routerOptions);
|
this.render('emailVerification', routerOptions);
|
||||||
} else {
|
} else {
|
||||||
this.render('worklist', routerOptions);
|
this.render('worklist', routerOptions);
|
||||||
@ -53,7 +49,7 @@ Router.route('/', function() {
|
|||||||
Router.route('/worklist', function() {
|
Router.route('/worklist', function() {
|
||||||
// Check user is logged in
|
// Check user is logged in
|
||||||
if(Meteor.user() && Meteor.userId()) {
|
if(Meteor.user() && Meteor.userId()) {
|
||||||
if (!Meteor.user().emails[0].verified && Session.get("verifyEmail")) {
|
if (!Meteor.user().emails[0].verified && verifyEmail) {
|
||||||
this.render('emailVerification', routerOptions);
|
this.render('emailVerification', routerOptions);
|
||||||
} else {
|
} else {
|
||||||
this.render('worklist', routerOptions);
|
this.render('worklist', routerOptions);
|
||||||
|
|||||||
@ -29,7 +29,10 @@ Meteor.startup(function() {
|
|||||||
aeTitle: 'ORTHANC',
|
aeTitle: 'ORTHANC',
|
||||||
default: true
|
default: true
|
||||||
}],
|
}],
|
||||||
defaultServiceType: 'dicomWeb'
|
"defaultServiceType": 'dicomWeb',
|
||||||
|
"public": {
|
||||||
|
"verifyEmail": false
|
||||||
|
}
|
||||||
//defaultServiceType: 'dimse'
|
//defaultServiceType: 'dimse'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,34 +1,34 @@
|
|||||||
|
Meteor.startup(function () {
|
||||||
|
|
||||||
/*Meteor.startup(function () {
|
// Mail server settings
|
||||||
|
var username = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.username || null;
|
||||||
|
var password = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.password || null;
|
||||||
|
var server = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.server || null;
|
||||||
|
var port = Meteor.settings && Meteor.settings.mailServerSettings && Meteor.settings.mailServerSettings.port || null;
|
||||||
|
var verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false;
|
||||||
|
|
||||||
// Mail server settings
|
if (verifyEmail && username && password && server && port) {
|
||||||
var username = "";
|
Accounts.emailTemplates.siteName = 'Lesion Tracker';
|
||||||
var password = "";
|
Accounts.emailTemplates.from = 'Lesion Tracker Admin <'+username+'>';
|
||||||
var server = "";
|
|
||||||
var port = "";
|
|
||||||
|
|
||||||
Accounts.emailTemplates.siteName = 'Lesion Tracker';
|
process.env.MAIL_URL = 'smtp://' +
|
||||||
Accounts.emailTemplates.from = 'Lesion Tracker Admin <'+username+'>';
|
|
||||||
|
|
||||||
|
|
||||||
process.env.MAIL_URL = 'smtp://' +
|
|
||||||
encodeURIComponent(username) + ':' +
|
encodeURIComponent(username) + ':' +
|
||||||
encodeURIComponent(password) + '@' +
|
encodeURIComponent(password) + '@' +
|
||||||
encodeURIComponent(server) + ':' + port;
|
encodeURIComponent(server) + ':' + port;
|
||||||
|
|
||||||
// Subject line of the email.
|
// Subject line of the email.
|
||||||
Accounts.emailTemplates.verifyEmail.subject = function(user) {
|
Accounts.emailTemplates.verifyEmail.subject = function(user) {
|
||||||
return 'Confirm Your Email Address for Lesion Tracker';
|
return 'Confirm Your Email Address for Lesion Tracker';
|
||||||
};
|
};
|
||||||
|
|
||||||
// Email text
|
// Email text
|
||||||
Accounts.emailTemplates.verifyEmail.text = function(user, url) {
|
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;
|
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
|
// Send email when account is created
|
||||||
Accounts.config({
|
Accounts.config({
|
||||||
sendVerificationEmail: true
|
sendVerificationEmail: true
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
*/
|
});
|
||||||
@ -24,15 +24,20 @@ Template.lesionTrackerLayout.helpers({
|
|||||||
},
|
},
|
||||||
|
|
||||||
currentUser: function() {
|
currentUser: function() {
|
||||||
if (Meteor.user() && Meteor.userId()) {
|
var verifyEmail = Meteor.settings && Meteor.settings.public && Meteor.settings.public.verifyEmail || false;
|
||||||
if (Session.get("verifyEmail")) {
|
|
||||||
if (Meteor.user().emails[0].verified) {
|
if (!Meteor.user() || !Meteor.userId()) {
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
if (!verifyEmail) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Meteor.user().emails[0].verified) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -44,7 +49,7 @@ Template.lesionTrackerLayout.onCreated(function() {
|
|||||||
// Show countdown dialog
|
// Show countdown dialog
|
||||||
var handle;
|
var handle;
|
||||||
$(document).on('TriggerOpenTimeoutCountdownDialog', function(e, leftTime) {
|
$(document).on('TriggerOpenTimeoutCountdownDialog', function(e, leftTime) {
|
||||||
// TODO: Show modal dialog
|
// Show modal dialog
|
||||||
handle = setInterval(function() {
|
handle = setInterval(function() {
|
||||||
leftTime--;
|
leftTime--;
|
||||||
// Set countdownDialogLeftTime session
|
// Set countdownDialogLeftTime session
|
||||||
|
|||||||
@ -23,6 +23,14 @@
|
|||||||
"staleSessionPurgeInterval": 15000,
|
"staleSessionPurgeInterval": 15000,
|
||||||
"staleSessionActivityEvents": "mousemove click keydown",
|
"staleSessionActivityEvents": "mousemove click keydown",
|
||||||
"showCountdownDialog": true,
|
"showCountdownDialog": true,
|
||||||
"dialogTimeout": 30000
|
"dialogTimeout": 30000,
|
||||||
|
"verifyEmail": false
|
||||||
|
},
|
||||||
|
"mailServerSettings": {
|
||||||
|
"username": "",
|
||||||
|
"password": "",
|
||||||
|
"server": "",
|
||||||
|
"port": ""
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user