Commit 217abcceeb64b705dde82e1c57541a3e0666450f
1 parent
d0099dd882
Exists in
master
added a way to run meteor with settings file
Showing
17 changed files
with
144 additions
and
108 deletions
Show diff stats
imports/server/accounts.js
1 | import '/imports/server/emails/config'; | File was deleted | |
2 | import './accounts/email-templates'; | ||
3 | import './accounts/verifyEmail'; | ||
4 | import './accounts/login'; | ||
5 | import './accounts/resetPassword'; | ||
6 | import '/imports/server/emails/invite'; | ||
7 | import '/imports/server/pages/verifyEmail'; | ||
8 | |||
9 | import './accounts/creation'; | ||
10 | 1 | import '/imports/server/emails/config'; |
imports/server/accounts/email-templates.js
1 | import { Accounts } from 'meteor/accounts-base'; | File was deleted | |
2 | |||
3 | const name = 'Application Name'; | ||
4 | const email = '<support@application.com>'; | ||
5 | const from = `${name} ${email}`; | ||
6 | const emailTemplates = Accounts.emailTemplates; | ||
7 | |||
8 | emailTemplates.siteName = name; | ||
9 | emailTemplates.from = from; | ||
10 | |||
11 | emailTemplates.resetPassword = { | ||
12 | subject() { | ||
13 | return `[${name}] Reset Your Password`; | ||
14 | }, | ||
15 | text(user, url) { | ||
16 | const userEmail = user.emails[0].address; | ||
17 | const urlWithoutHash = url.replace('#/', ''); | ||
18 | |||
19 | return `A password reset has been requested for the account related to this | ||
20 | address (${userEmail}). To reset the password, visit the following link: | ||
21 | \n\n${urlWithoutHash}\n\n If you did not request this reset, please ignore | ||
22 | this email. If you feel something is wrong, please contact our support team: | ||
23 | ${email}.`; | ||
24 | }, | ||
25 | }; | ||
26 | 1 | import { Accounts } from 'meteor/accounts-base'; |
imports/server/accounts/index.js
File was created | 1 | import './creation'; | |
2 | import './login'; | ||
3 |
imports/server/accounts/resetPassword.js
1 | import _ from 'lodash'; | File was deleted | |
2 | import { Accounts } from 'meteor/accounts-base'; | ||
3 | |||
4 | |||
5 | Accounts.emailTemplates.resetPassword = { | ||
6 | subject() { | ||
7 | return '[Blok8] Reset Your Password'; | ||
8 | }, | ||
9 | text(user, url) { | ||
10 | const userEmail = user.emails[0].address; | ||
11 | const theUrl = Meteor.absoluteUrl(`?enter=reset&token=${_.last(url.split('/'))}`); | ||
12 | // const theUrl = decodeURI(`\u003D`); | ||
13 | |||
14 | return ( | ||
15 | ` | ||
16 | Hello, ${user.firstName}! | ||
17 | |||
18 | |||
19 | A password reset has been requested for the account related to this address. | ||
20 | To reset the password, visit the following link: | ||
21 | |||
22 | ${theUrl} | ||
23 | |||
24 | If you did not request this reset, please ignore this email. | ||
25 | |||
26 | ` | ||
27 | ); | ||
28 | }, | ||
29 | }; | ||
30 | |||
31 | |||
32 | 1 | import _ from 'lodash'; |
imports/server/accounts/verifyEmail.js
1 | import _ from 'lodash'; | File was deleted | |
2 | import { Accounts } from 'meteor/accounts-base'; | ||
3 | |||
4 | Accounts.config({ | ||
5 | sendVerificationEmail: true | ||
6 | }); | ||
7 | |||
8 | Accounts.emailTemplates.verifyEmail = { | ||
9 | subject() { | ||
10 | return '[YoungDesk] Verify Your Email Address'; | ||
11 | }, | ||
12 | text(user, url) { | ||
13 | const theUrl = Meteor.absoluteUrl(`back/verifyEmail/${_.last(url.split('/'))}`); | ||
14 | |||
15 | return ( | ||
16 | ` | ||
17 | Hello, ${user.firstName}! | ||
18 | |||
19 | |||
20 | To verify your email address, visit the following link: | ||
21 | |||
22 | ${theUrl} | ||
23 | |||
24 | If you did not request this verification, please ignore this email. | ||
25 | |||
26 | ` | ||
27 | ); | ||
28 | }, | ||
29 | }; | ||
30 | 1 | import _ from 'lodash'; |
imports/server/emails/config.js
1 | // process.env.MAIL_URL = "smtp://postmaster%40sandboxdac306638463443cb5d8adc4380ea78d.mailgun.org:9a2131ff0360b37dae90faca340e6b8f@smtp.mailgun.org:587"; | 1 | // process.env.MAIL_URL = "smtp://postmaster%40sandboxdac306638463443cb5d8adc4380ea78d.mailgun.org:9a2131ff0360b37dae90faca340e6b8f@smtp.mailgun.org:587"; |
2 | // process.env.MAIL_URL = "smtp://block8:cfxJfbe7xI7qfTgE2DB22g@smtp.mandrillapp.com:587"; /* Test Mode */ | 2 | // process.env.MAIL_URL = "smtp://block8:cfxJfbe7xI7qfTgE2DB22g@smtp.mandrillapp.com:587"; /* Test Mode */ |
3 | 3 | ||
4 | import { Accounts } from 'meteor/accounts-base'; | 4 | import { Accounts } from 'meteor/accounts-base'; |
5 | 5 | ||
6 | if(Meteor.settings.public.environment === 'production') { | 6 | process.env.MAIL_URL = Meteor.settings.private.mandrill.mailUrl; |
7 | process.env.MAIL_URL = "smtp://block8:Ih-DuTSHlO-bdiPE7FBl3Q@smtp.mandrillapp.com:587"; | ||
8 | } | ||
9 | Accounts.emailTemplates.siteName = 'YoungDesk'; | 7 | Accounts.emailTemplates.siteName = 'YoungDesk'; |
10 | Accounts.emailTemplates.from = 'YoungDesk <support@youngdesk.com>'; | 8 | Accounts.emailTemplates.from = 'YoungDesk <support@youngdesk.com>'; |
9 | console.log(Accounts.emailTemplates.from); |
imports/server/emails/index.js
File was created | 1 | import '/imports/server/emails/config'; | |
2 | import '/imports/server/emails/verifyEmail'; | ||
3 | import '/imports/server/emails/resetPassword'; | ||
4 | import '/imports/server/emails/invite'; | ||
5 | import '/imports/server/pages/verifyEmail'; | ||
6 |
imports/server/emails/invite.js
1 | import { Email } from 'meteor/email' | 1 | import { Email } from 'meteor/email' |
2 | import {moment} from 'meteor/momentjs:moment' | 2 | import {moment} from 'meteor/momentjs:moment' |
3 | moment.locale('en-au'); | 3 | moment.locale('en-au'); |
4 | 4 | ||
5 | export const sendInviteEmail = ({email, firstName, orgName, token}) => { | 5 | export const sendInviteEmail = ({email, firstName, orgName, token}) => { |
6 | const url = Meteor.absoluteUrl(`invite/${token}`); | 6 | const url = Meteor.absoluteUrl(`invite/${token}`); |
7 | const text = ` | 7 | const text = ` |
8 | Hello, ${firstName}! | 8 | Hello, ${firstName}! |
9 | 9 | ||
10 | You have been invited to join the ${orgName} on Blok8 wallet. | 10 | You have been invited to join the ${orgName} on Blok8 wallet. |
11 | To join, use the following link: | 11 | To join, use the following link: |
12 | 12 | ||
13 | ${url} | 13 | ${url} |
14 | `; | 14 | `; |
15 | 15 | ||
16 | Email.send({ | 16 | Email.send({ |
17 | from: 'Blok 8 <support@mystake.io>', | 17 | from: 'YoungDesk <support@youngdesk.com>', |
18 | to: email, | 18 | to: email, |
19 | subject: `[Blok8] Invitation to ${orgName}`, | 19 | subject: `[YoungDesk] Invitation`, |
20 | text: text, | 20 | text: text, |
21 | }); | 21 | }); |
22 | 22 | ||
23 | }; | 23 | }; |
24 | 24 | ||
25 | export const sendChangeSharePriceEmail = ({orgName, firstName, lastName, price, email}) => { | 25 | export const sendChangeSharePriceEmail = ({orgName, firstName, lastName, price, email}) => { |
26 | const text = ` | 26 | const text = ` |
27 | Hi ${firstName}, | 27 | Hi ${firstName}, |
28 | 28 | ||
29 | The current share price has been changed to $A${price} for the company ${orgName}. | 29 | The current share price has been changed to $A${price} for the company ${orgName}. |
30 | `; | 30 | `; |
31 | 31 | ||
32 | Email.send({ | 32 | Email.send({ |
33 | from: 'Blok 8 <support@mystake.io>', | 33 | from: 'Blok 8 <support@youngdesk.com>', |
34 | to: email, | 34 | to: email, |
35 | subject: `[Blok8] Share price has changed for ${orgName}.`, | 35 | subject: `[Blok8] Share price has changed for ${orgName}.`, |
36 | text: text, | 36 | text: text, |
37 | }); | 37 | }); |
38 | 38 | ||
39 | }; | 39 | }; |
40 | 40 | ||
41 | export const sendChangeNameEmail = ({firstName, lastName, email}) => { | 41 | export const sendChangeNameEmail = ({firstName, lastName, email}) => { |
42 | 42 | ||
43 | console.log(firstName); | 43 | console.log(firstName); |
44 | console.log(lastName); | 44 | console.log(lastName); |
45 | console.log(email); | 45 | console.log(email); |
46 | const text = ` | 46 | const text = ` |
47 | Hi ${firstName}, | 47 | Hi ${firstName}, |
48 | 48 | ||
49 | Your name has been changed to "${firstName} ${lastName}". | 49 | Your name has been changed to "${firstName} ${lastName}". |
50 | 50 | ||
51 | If you did not change your name, please reset your password. | 51 | If you did not change your name, please reset your password. |
52 | `; | 52 | `; |
53 | 53 | ||
54 | Email.send({ | 54 | Email.send({ |
55 | from: 'Blok 8 <support@mystake.io>', | 55 | from: 'Blok 8 <support@youngdesk.com>', |
56 | to: email, | 56 | to: email, |
57 | subject: `[Blok8] - Name Change`, | 57 | subject: `[Blok8] - Name Change`, |
58 | text: text, | 58 | text: text, |
59 | }); | 59 | }); |
60 | 60 | ||
61 | }; | 61 | }; |
62 | 62 | ||
63 | export const sendChangePasswordEmail = ({firstName, lastName, email}) => { | 63 | export const sendChangePasswordEmail = ({firstName, lastName, email}) => { |
64 | 64 | ||
65 | console.log(firstName); | 65 | console.log(firstName); |
66 | console.log(lastName); | 66 | console.log(lastName); |
67 | console.log(email); | 67 | console.log(email); |
68 | let date = moment().format('LLL'); | 68 | let date = moment().format('LLL'); |
69 | const text = ` | 69 | const text = ` |
70 | Hi ${firstName}, | 70 | Hi ${firstName}, |
71 | 71 | ||
72 | Your password was recently changed on ${date}. | 72 | Your password was recently changed on ${date}. |
73 | 73 | ||
74 | If you did not change your password, please reset your password immediately. | 74 | If you did not change your password, please reset your password immediately. |
75 | `; | 75 | `; |
76 | 76 | ||
77 | Email.send({ | 77 | Email.send({ |
78 | from: 'Blok 8 <support@mystake.io>', | 78 | from: 'Blok 8 <support@youngdesk.com>', |
79 | to: email, | 79 | to: email, |
80 | subject: `[Blok8] - Password Change`, | 80 | subject: `[Blok8] - Password Change`, |
81 | text: text, | 81 | text: text, |
82 | }); | 82 | }); |
83 | 83 | ||
84 | }; | 84 | }; |
85 | 85 | ||
86 | export const sendChangeEmail = ({firstName, lastName, email, newEmail}) => { | 86 | export const sendChangeEmail = ({firstName, lastName, email, newEmail}) => { |
87 | 87 | ||
88 | console.log(firstName); | 88 | console.log(firstName); |
89 | console.log(lastName); | 89 | console.log(lastName); |
90 | console.log(email); | 90 | console.log(email); |
91 | let date = moment().format('LLL'); | 91 | let date = moment().format('LLL'); |
92 | const text = ` | 92 | const text = ` |
93 | Hi ${firstName}, | 93 | Hi ${firstName}, |
94 | 94 | ||
95 | Your email address was recently changed on ${newEmail} on ${date}. | 95 | Your email address was recently changed on ${newEmail} on ${date}. |
96 | 96 | ||
97 | If you did not change your email address, please contact us immediately by responding to this email. | 97 | If you did not change your email address, please contact us immediately by responding to this email. |
98 | `; | 98 | `; |
99 | 99 | ||
100 | Email.send({ | 100 | Email.send({ |
101 | from: 'Blok 8 <support@mystake.io>', | 101 | from: 'Blok 8 <support@youngdesk.com>', |
102 | to: email, | 102 | to: email, |
103 | subject: `[Blok8] - Email Change`, | 103 | subject: `[Blok8] - Email Change`, |
104 | text: text, | 104 | text: text, |
105 | }); | 105 | }); |
106 | 106 | ||
107 | }; | 107 | }; |
108 | 108 | ||
109 | 109 | ||
110 | export const sendIssueSharesEmail = ({orgName, firstName, lastName, quantity, purchasePrice, shareClass,email}) => { | 110 | export const sendIssueSharesEmail = ({orgName, firstName, lastName, quantity, purchasePrice, shareClass,email}) => { |
111 | console.log(quantity); | 111 | console.log(quantity); |
112 | console.log(purchasePrice); | 112 | console.log(purchasePrice); |
113 | console.log(shareClass); | 113 | console.log(shareClass); |
114 | console.log(email); | 114 | console.log(email); |
115 | const text = ` | 115 | const text = ` |
116 | Hi ${firstName}, | 116 | Hi ${firstName}, |
117 | 117 | ||
118 | ${quantity} ${shareClass} shares in ${orgName} have been issued to you for A$${purchasePrice} in total. | 118 | ${quantity} ${shareClass} shares in ${orgName} have been issued to you for A$${purchasePrice} in total. |
119 | 119 | ||
120 | `; | 120 | `; |
121 | 121 | ||
122 | Email.send({ | 122 | Email.send({ |
123 | from: 'Blok 8 <support@mystake.io>', | 123 | from: 'Blok 8 <support@youngdesk.com>', |
124 | to: email, | 124 | to: email, |
125 | subject: `[Blok8] New shares have been issued to you in ${orgName}.`, | 125 | subject: `[Blok8] New shares have been issued to you in ${orgName}.`, |
126 | text: text, | 126 | text: text, |
127 | }); | 127 | }); |
128 | 128 | ||
129 | }; | 129 | }; |
130 | 130 | ||
131 | export const sendNewAnnouncementsEmail = ({orgId, orgName, createdByUser, title, description, uniqueUrl, firstName, lastName, email}) => { | 131 | export const sendNewAnnouncementsEmail = ({orgId, orgName, createdByUser, title, description, uniqueUrl, firstName, lastName, email}) => { |
132 | const text = ` | 132 | const text = ` |
133 | Hi ${firstName}, | 133 | Hi ${firstName}, |
134 | 134 | ||
135 | A new announcement has been issued by the company secretary! | 135 | A new announcement has been issued by the company secretary! |
136 | 136 | ||
137 | Title: ${title}. | 137 | Title: ${title}. |
138 | 138 | ||
139 | `; | 139 | `; |
140 | 140 | ||
141 | Email.send({ | 141 | Email.send({ |
142 | from: 'Blok 8 <support@mystake.io>', | 142 | from: 'Blok 8 <support@youngdesk.com>', |
143 | to: email, | 143 | to: email, |
144 | subject: `[Blok8] ${orgName} - New Announcement`, | 144 | subject: `[Blok8] ${orgName} - New Announcement`, |
145 | text: text, | 145 | text: text, |
146 | }); | 146 | }); |
147 | 147 | ||
148 | }; | 148 | }; |
149 | 149 | ||
150 | 150 | ||
151 | export const sendIssueDividendsEmail = ({ orgId, orgName, dividend, firstName, lastName, email }) => { | 151 | export const sendIssueDividendsEmail = ({ orgId, orgName, dividend, firstName, lastName, email }) => { |
152 | const text = ` | 152 | const text = ` |
153 | Hi ${firstName}! | 153 | Hi ${firstName}! |
154 | 154 | ||
155 | A new dividend has been issued at $A${dividend} per ordinary share for the company "${orgName}". | 155 | A new dividend has been issued at $A${dividend} per ordinary share for the company "${orgName}". |
156 | 156 | ||
157 | `; | 157 | `; |
158 | 158 | ||
159 | Email.send({ | 159 | Email.send({ |
160 | from: 'Blok 8 <support@mystake.io>', | 160 | from: 'Blok 8 <support@mystake.io>', |
161 | to: email, | 161 | to: email, |
162 | subject: `[Blok8] A new dividend has been issued by ${orgName}`, | 162 | subject: `[Blok8] A new dividend has been issued by ${orgName}`, |
163 | text: text, | 163 | text: text, |
164 | }); | 164 | }); |
165 | 165 | ||
166 | }; | 166 | }; |
167 | 167 |
imports/server/emails/resetPassword.js
File was created | 1 | import _ from 'lodash'; | |
2 | import { Accounts } from 'meteor/accounts-base'; | ||
3 | |||
4 | |||
5 | Accounts.emailTemplates.resetPassword = { | ||
6 | subject() { | ||
7 | return '[YoungDesk] Reset Your Password'; | ||
8 | }, | ||
9 | text(user, url) { | ||
10 | console.log(user); | ||
11 | const userEmail = user.emails[0].address; | ||
12 | const theUrl = Meteor.absoluteUrl(`?enter=reset&token=${_.last(url.split('/'))}`); | ||
13 | // const theUrl = decodeURI(`\u003D`); | ||
14 | |||
15 | return ( | ||
16 | ` | ||
17 | Hello, ${user.firstName}! | ||
18 | |||
19 | |||
20 | A password reset has been requested for the account related to this address. | ||
21 | To reset the password, visit the following link: | ||
22 | |||
23 | ${theUrl} | ||
24 | |||
25 | If you did not request this reset, please ignore this email. | ||
26 | |||
27 | ` | ||
28 | ); | ||
29 | }, | ||
30 | }; | ||
31 |
imports/server/emails/verifyEmail.js
File was created | 1 | import _ from 'lodash'; | |
2 | import { Accounts } from 'meteor/accounts-base'; | ||
3 | |||
4 | Accounts.config({ | ||
5 | sendVerificationEmail: true | ||
6 | }); | ||
7 | |||
8 | Accounts.emailTemplates.verifyEmail = { | ||
9 | subject() { | ||
10 | return '[YoungDesk] Verify Your Email Address'; | ||
11 | }, | ||
12 | text(user, url) { | ||
13 | console.log(user); | ||
14 | if(user.firstName){ | ||
15 | const name = user.firstName; | ||
16 | }else{ | ||
17 | const name = user.profile.firstName; | ||
18 | } | ||
19 | const name = user.firstName; | ||
20 | const theUrl = Meteor.absoluteUrl(`back/verifyEmail/${_.last(url.split('/'))}`); | ||
21 | |||
22 | return ( | ||
23 | ` | ||
24 | Hello, ${name}! | ||
25 | |||
26 | |||
27 | To verify your email address, visit the following link: | ||
28 | |||
29 | ${theUrl} | ||
30 | |||
31 | If you did not request this verification, please ignore this email. | ||
32 | |||
33 | ` | ||
34 | ); | ||
35 | }, | ||
36 | }; | ||
37 |
imports/server/index.js
1 | import './accounts'; | 1 | import './accounts/index'; |
2 | import './collections'; | 2 | import './collections'; |
3 | import './browser-policy'; | 3 | import './browser-policy'; |
4 | import './fixtures'; | 4 | import './fixtures'; |
5 | import './emails/index'; | ||
5 | 6 |
run/app
File was created | 1 | #!/bin/bash | |
2 | |||
3 | # "0123012301230123" | ||
4 | ./run/echo "START METEOR APP" | ||
5 | |||
6 | meteor --settings settings-development.json | ||
7 |
run/app.sh
File was created | 1 | #!/bin/bash | |
2 | |||
3 | # "0123012301230123" | ||
4 | meteor --settings settings-development.json | ||
5 |
run/debug
File was created | 1 | #!/bin/bash | |
2 | |||
3 | # "0123012301230123" | ||
4 | ./run/echo "APP INSPECT MODE" | ||
5 | |||
6 | cd app && FORCE_COLOR=true NODE_OPTIONS='--inspect' meteor --settings settings-development.json | ||
7 | |||
8 | |||
9 |
run/echo
File was created | 1 | #!/bin/bash | |
2 | |||
3 | |||
4 | echo -e "" | ||
5 | echo -e "" | ||
6 | echo -e "\033[96m\033[1m ╔════════════════════════╗ \033[0m" | ||
7 | echo -e "\033[96m\033[1m ║ ╔════════════════════╗ ║ \033[0m" | ||
8 | echo -e "\033[96m\033[1m ║ ║ ║ ║ \033[0m" | ||
9 | echo -e "\033[96m\033[1m ║ ║ YoungDesk ║ ║ \033[0m" | ||
10 | echo -e "\033[96m\033[1m ║ ║ ║ ║ \033[0m" | ||
11 | echo -e "\033[96m\033[1m ║ ╟────────────────────╢ ║ \033[0m" | ||
12 | echo -e "\033[96m\033[1m ║ ║ ║ ║ \033[0m" | ||
13 | echo -e "\033[96m\033[1m ║ ║ \033[91m\033[1m$1\033[96m\033[1m ║ ║ \033[0m" | ||
14 | echo -e "\033[96m\033[1m ║ ║ ║ ║ \033[0m" | ||
15 | echo -e "\033[96m\033[1m ║ ╚══════╗\033[91m\033[1m╔════╗\033[96m\033[1m╔══════╝ ║ \033[0m" | ||
16 | echo -e "\033[96m\033[1m ╚════════╝\033[91m\033[1m╚════╝\033[96m\033[1m╚════════╝ \033[0m" | ||
17 | echo -e "" | ||
18 | echo -e "" | ||
19 |
run/reset_meteor
File was created | 1 | #!/bin/bash | |
2 | |||
3 | # "0123012301230123" | ||
4 | ./run/echo "RESET METEOR APP" | ||
5 | |||
6 | cd app && FORCE_COLOR=true meteor reset | ||
7 | |||
8 | |||
9 |
settings-development.json
1 | { | 1 | { |
2 | "public": {}, | 2 | "private": { |
3 | "private": {} | 3 | "twilio": { |
4 | "accountSID": "", | ||
5 | "authToken": "", | ||
6 | "from": "" | ||
7 | }, | ||
8 | "mandrill": { | ||
9 | "key": "jr9TRxivdGDrsyI_bmRZLg", | ||
10 | "testKey": "UbqDNTDINDq5fCAkzb0-DQ", | ||
11 | "mailUrl": "smtp://Youngdesk:3AY0e6pF9Alpv5-GjrQxAA@smtp.mandrillapp.com:587" | ||
12 | } | ||
13 | }, | ||
14 | "public": { | ||
15 | "environment": "development" | ||
16 | } | ||
4 | } | 17 | } |
5 | 18 |