OHIF-55: Add Test Drive button to login with demo user for Lesion Tracker
This commit is contained in:
parent
4b627198b7
commit
793c2f3c0f
@ -26,7 +26,8 @@ Package.onUse(function (api) {
|
|||||||
|
|
||||||
api.use([
|
api.use([
|
||||||
'zuuk:stale-session@1.0.8',
|
'zuuk:stale-session@1.0.8',
|
||||||
'typ:accounts-ldap'
|
'typ:accounts-ldap',
|
||||||
|
'random'
|
||||||
], ['client', 'server']);
|
], ['client', 'server']);
|
||||||
|
|
||||||
api.addFiles([
|
api.addFiles([
|
||||||
|
|||||||
@ -0,0 +1,25 @@
|
|||||||
|
import { Template } from 'meteor/templating';
|
||||||
|
import { ActiveEntry } from 'meteor/clinical:active-entry';
|
||||||
|
|
||||||
|
|
||||||
|
Template.entrySignIn.hooks({
|
||||||
|
|
||||||
|
rendered: function () {
|
||||||
|
// Create Test Drive button dynamically
|
||||||
|
let btnTestDrive = $('<button/>', {
|
||||||
|
id: 'btnTestDrive',
|
||||||
|
text: 'Test Drive',
|
||||||
|
class: 'btn btn-primary',
|
||||||
|
style: 'position: absolute; width: 150px; top: 20px; right: 20px; padding-left: 0;',
|
||||||
|
title: 'Login with Demo User',
|
||||||
|
click: function () {
|
||||||
|
// Login with demo user
|
||||||
|
ActiveEntry.signIn('demo@ohif.org', '12345678aA*');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
const entrySignIn = this.find('#entrySignIn');
|
||||||
|
$(entrySignIn).append(btnTestDrive);
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
@ -101,6 +101,8 @@ Package.onUse(function(api) {
|
|||||||
api.addFiles('client/components/activeEntry/activeEntry.styl', 'client');
|
api.addFiles('client/components/activeEntry/activeEntry.styl', 'client');
|
||||||
api.addFiles('client/components/activeEntry/activeEntry.js', 'client');
|
api.addFiles('client/components/activeEntry/activeEntry.js', 'client');
|
||||||
|
|
||||||
|
api.addFiles('client/components/activeEntry/activeEntrySignIn/activeEntrySignIn.js', 'client');
|
||||||
|
|
||||||
api.addFiles('client/components/hipaaLogPage/hipaaLogPage.styl', 'client');
|
api.addFiles('client/components/hipaaLogPage/hipaaLogPage.styl', 'client');
|
||||||
api.addFiles('client/components/hipaaLogPage/hipaaLogPage.js', 'client');
|
api.addFiles('client/components/hipaaLogPage/hipaaLogPage.js', 'client');
|
||||||
|
|
||||||
@ -211,6 +213,7 @@ Package.onUse(function(api) {
|
|||||||
api.addFiles('server/publications.js', 'server');
|
api.addFiles('server/publications.js', 'server');
|
||||||
api.addFiles('server/methods.js', [ 'server' ]);
|
api.addFiles('server/methods.js', [ 'server' ]);
|
||||||
api.addFiles('server/reviewers.js', [ 'server' ]);
|
api.addFiles('server/reviewers.js', [ 'server' ]);
|
||||||
|
api.addFiles('server/createDemoUser.js', [ 'server' ]);
|
||||||
|
|
||||||
// Both client and server functions
|
// Both client and server functions
|
||||||
api.addFiles('both/collections.js', [ 'client', 'server' ]);
|
api.addFiles('both/collections.js', [ 'client', 'server' ]);
|
||||||
|
|||||||
39
Packages/lesiontracker/server/createDemoUser.js
Normal file
39
Packages/lesiontracker/server/createDemoUser.js
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
import { Accounts } from 'meteor/accounts-base';
|
||||||
|
|
||||||
|
|
||||||
|
Meteor.startup(function() {
|
||||||
|
const options = {
|
||||||
|
email: 'demo@ohif.org',
|
||||||
|
password: '12345678aA*',
|
||||||
|
profile: {
|
||||||
|
fullName: 'Demo User'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
createDemoUser = function() {
|
||||||
|
const user = Meteor.users.findOne({
|
||||||
|
emails: {
|
||||||
|
$elemMatch: {
|
||||||
|
address: 'demo@ohif.org'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (user) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log('create user!');
|
||||||
|
|
||||||
|
// Create user
|
||||||
|
const userId = Accounts.createUser(options);
|
||||||
|
|
||||||
|
if (!userId) {
|
||||||
|
console.log('Demo user cannot be created');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create demo user
|
||||||
|
createDemoUser();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user