Copied starter Meteor App files.
Cut and paste of the BasicMeteorApp.
This commit is contained in:
83
imports/startup/both/accounts.js
Normal file
83
imports/startup/both/accounts.js
Normal file
@@ -0,0 +1,83 @@
|
||||
import { AccountsTemplates } from 'meteor/useraccounts:core';
|
||||
|
||||
AccountsTemplates.configure({
|
||||
forbidClientAccountCreation: true, //Turn off client side account creation. The app is expected to have a feature that will do this.
|
||||
showForgotPasswordLink: true,
|
||||
defaultTemplate: 'OverrideAtForm',
|
||||
//defaultTemplate: 'AuthorizationPage', //The template for all the forms related to logging in or out.
|
||||
defaultLayout: 'Login', //What page template to place the defaultTemplate in.
|
||||
defaultContentRegion: 'content', //The content region of the page template to place the defaultTemplate in.
|
||||
defaultLayoutRegions: {},
|
||||
// defaultLayout: 'Body',
|
||||
// defaultContentRegion: 'content',
|
||||
// defaultLayoutRegions: {}
|
||||
texts: {
|
||||
title: {
|
||||
signIn: ""
|
||||
},
|
||||
button: {
|
||||
signIn: "Enter"
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// This removes the password field but returns it,
|
||||
// so that you can re-add it later, preserving the
|
||||
// desired order of the fields
|
||||
// let pwd = AccountsTemplates.removeField('password');
|
||||
// AccountsTemplates.removeField('email');
|
||||
// AccountsTemplates.addFields([
|
||||
// {
|
||||
// _id: "username",
|
||||
// type: "text",
|
||||
// displayName: "username",
|
||||
// required: true,
|
||||
// minLength: 5,
|
||||
// },
|
||||
// pwd
|
||||
// ]);
|
||||
let pwd = AccountsTemplates.removeField('password');
|
||||
|
||||
AccountsTemplates.removeField('email');
|
||||
AccountsTemplates.addFields([
|
||||
{
|
||||
_id: "username",
|
||||
type: "text",
|
||||
displayName: "username",
|
||||
required: true,
|
||||
minLength: 5,
|
||||
},
|
||||
{
|
||||
_id: 'email',
|
||||
type: 'email',
|
||||
required: true,
|
||||
displayName: "email",
|
||||
re: /.+@(.+){2,}\.(.+){2,}/,
|
||||
errStr: 'Invalid email',
|
||||
},
|
||||
{
|
||||
_id: 'username_and_email',
|
||||
type: 'text',
|
||||
required: true,
|
||||
displayName: "Login",
|
||||
placeholder: "Login / Email"
|
||||
},
|
||||
pwd
|
||||
]);
|
||||
|
||||
//AccountsTemplates.configureRoute('signIn', {
|
||||
// name: 'signin',
|
||||
// path: '/Admin/SignIn'
|
||||
//});
|
||||
//// AccountsTemplates.configureRoute('signUp', {
|
||||
//// name: 'join',
|
||||
//// path: '/join'
|
||||
//// });
|
||||
//AccountsTemplates.configureRoute('forgotPwd', {
|
||||
// name: 'forgotPwd',
|
||||
// path: '/Admin/ForgotPwd'
|
||||
//});
|
||||
//AccountsTemplates.configureRoute('resetPwd', {
|
||||
// name: 'resetPwd',
|
||||
// path: '/Admin/ResetPwd'
|
||||
//});
|
||||
1
imports/startup/both/index.js
Normal file
1
imports/startup/both/index.js
Normal file
@@ -0,0 +1 @@
|
||||
import './accounts.js';
|
||||
1
imports/startup/client/index.js
Normal file
1
imports/startup/client/index.js
Normal file
@@ -0,0 +1 @@
|
||||
import './routes.js';
|
||||
56
imports/startup/client/routes.js
Normal file
56
imports/startup/client/routes.js
Normal file
@@ -0,0 +1,56 @@
|
||||
require('/imports/startup/both/accounts.js'); //Ensure that the user accounts templates are setup first. We have included the AccountTemplates routing in this document to keep all routing in one place.
|
||||
|
||||
//**** GROUPS
|
||||
let pub = FlowRouter.group({
|
||||
});
|
||||
let pri = FlowRouter.group({
|
||||
//TODO: Require SSL
|
||||
triggersEnter: [AccountsTemplates.ensureSignedIn]
|
||||
});
|
||||
|
||||
//**** ADMIN
|
||||
pri.route("/admin", {
|
||||
triggersEnter: [function(context, redirect) {redirect("/Admin/Home");}]
|
||||
});
|
||||
pri.route("/Admin", {
|
||||
triggersEnter: [function(context, redirect) {redirect("/Admin/Home");}]
|
||||
});
|
||||
AccountsTemplates.configureRoute('signIn', {
|
||||
name: 'SignIn',
|
||||
path: '/Admin/SignIn'
|
||||
});
|
||||
AccountsTemplates.configureRoute('resetPwd', {
|
||||
name: 'ResetPwd',
|
||||
path: '/Admin/ResetPwd'
|
||||
});
|
||||
AccountsTemplates.configureRoute('forgotPwd', {
|
||||
name: 'ForgotPwd',
|
||||
path: '/Admin/ForgotPwd'
|
||||
});
|
||||
|
||||
pri.route("/Admin/Home", {
|
||||
name: "AdminHome",
|
||||
action: function(params, queryParams) {
|
||||
require("/imports/ui/AdminHome.js");
|
||||
BlazeLayout.render("Admin", {content: "AdminHome"})
|
||||
}
|
||||
});
|
||||
pri.route("/Admin/UserManagement", {
|
||||
name: "UserManagement",
|
||||
action: function(params, queryParams) {
|
||||
require("/imports/ui/UserManagement.js");
|
||||
BlazeLayout.render("Admin", {content: "UserManagement"})
|
||||
}
|
||||
});
|
||||
|
||||
//*** PUBLIC
|
||||
pub.route('/', {
|
||||
triggersEnter: [function(context, redirect) {redirect("/Home");}]
|
||||
});
|
||||
pub.route("/Home", {
|
||||
name: 'Home',
|
||||
action: function(params, queryParams) {
|
||||
require("/imports/ui/Home.js");
|
||||
BlazeLayout.render("Public", {content: "Home"});
|
||||
}
|
||||
});
|
||||
12
imports/startup/server/email.js
Normal file
12
imports/startup/server/email.js
Normal file
@@ -0,0 +1,12 @@
|
||||
|
||||
Accounts.emailTemplates.from = "Do Not Reply <administrator@declarativeengineering.com>";
|
||||
Accounts.emailTemplates.siteName = "Petit Teton App";
|
||||
// Accounts.emailTemplates.verifyEmail.subject = function (user) {
|
||||
// return "Welcome to My Site! Please verify your email";
|
||||
// };
|
||||
//
|
||||
// Accounts.emailTemplates.verifyEmail.html = function (user, url) {
|
||||
// return "Hi " + user.profile.firstName + " " + user.profile.lastName + ",\n\n" +
|
||||
// " Please verify your email by simply clicking the link below:\n\n" +
|
||||
// url;
|
||||
// };
|
||||
2
imports/startup/server/index.js
Normal file
2
imports/startup/server/index.js
Normal file
@@ -0,0 +1,2 @@
|
||||
import "./email.js"
|
||||
import "./../../util/polyfills/date.js"
|
||||
33
imports/startup/server/postStartup/version.js
Normal file
33
imports/startup/server/postStartup/version.js
Normal file
@@ -0,0 +1,33 @@
|
||||
let AppVersion = new Mongo.Collection('AppVersion');
|
||||
let AppVersionSchema = new SimpleSchema({
|
||||
version: {
|
||||
type: Number,
|
||||
optional: false,
|
||||
defaultValue: 0
|
||||
}
|
||||
});
|
||||
AppVersion.attachSchema(AppVersionSchema);
|
||||
|
||||
try {
|
||||
let appVersions = AppVersion.find({}).fetch();
|
||||
let appVersion;
|
||||
|
||||
if(!appVersions || appVersions.length == 0) { //This will happen only when first creating a database.
|
||||
appVersion = {version: 0};
|
||||
appVersion._id = AppVersion.insert(appVersion);
|
||||
}
|
||||
else if(appVersions.length > 1) { //This should never happen. Remove all but the first app version.
|
||||
for(let i = 1; i < appVersions.length; i++) {
|
||||
AppVersion.remove(appVersions[i]._id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
appVersion = appVersions[0];
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
catch(err) {
|
||||
console.log("Caught an error while upgrading the app version: " + err);
|
||||
process.exit(1);
|
||||
}
|
||||
Reference in New Issue
Block a user