| Hash | Commit message | Author | Date | Files | + | - |
1 | commit 03b766516a5abe1ce7f8869bf4454a8ded135e09 |
2 | Author: Connor Etherington <[email protected]> |
3 | Date: Sat Apr 15 08:29:52 2023 +0200 |
4 | |
5 | Auto-Commit Update 15.04.2023 - 08:29:52 |
6 | --- |
7 | {clients => config}/clients.json | 0 |
8 | config/templates/affiliate-register.html | 263 +++++++++++++++++++++++++++++++ |
9 | config/templates/user-register.html | 251 +++++++++++++++++++++++++++++ |
10 | methods/main.js | 91 +++++------ |
11 | methods/mkMail.js | 66 +++----- |
12 | methods/updateDB.js | 13 +- |
13 | models/template.js | 2 +- |
14 | routes/api.js | 20 ++- |
15 | 8 files changed, 596 insertions(+), 110 deletions(-) |
16 | |
17 | diff --git a/clients/clients.json b/config/clients.json |
18 | similarity index 100% |
19 | rename from clients/clients.json |
20 | rename to config/clients.json |
21 | diff --git a/config/templates/affiliate-register.html b/config/templates/affiliate-register.html |
22 | new file mode 100644 |
23 | index 0000000..b016cab |
24 | --- /dev/null |
25 | +++ b/config/templates/affiliate-register.html |
26 | @@ -0,0 +1,263 @@ |
27 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
28 | +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" style=" background-color: #c9c9c9"> |
29 | + <head> |
30 | + <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG></o> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> |
31 | + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> |
32 | + <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
33 | + <meta name="x-apple-disable-message-reformatting" /> |
34 | + <!--[if !mso]><!--> |
35 | + <meta http-equiv="X-UA-Compatible" content="IE=edge" /> |
36 | + <!--<![endif]--> |
37 | + <title></title> |
38 | + <style type="text/css">@media only screen and (min-width: 620px) { .u-row { width: 600px !important; } .u-row .u-col { vertical-align: top; } .u-row .u-col-50 { width: 300px !important; } .u-row .u-col-100 { width: 600px !important; } } @media (max-width: 620px) { .u-row-container { max-width: 100% !important; padding-left: 0px !important; padding-right: 0px !important; } .u-row .u-col { min-width: 320px !important; max-width: 100% !important; display: block !important; } .u-row { width: calc(100% - 40px) !important; } .u-col { width: 100% !important; } .u-col>div { margin: 0 auto; } } body { margin: 0; padding: 0; } table, tr, td { vertical-align: top; border-collapse: collapse; } p { margin: 0; } .ie-container table, .mso-container table { table-layout: fixed; } * { line-height: inherit; } a[x-apple-data-detectors='true'] { color: inherit !important; text-decoration: none !important; } table, td { color: #000000; } #u_body a { color: #03ff; text-decoration: underline; } @media (max-width: 480px) { #u_content_image_1 .v-src-width { width: auto !important; } #u_content_image_1 .v-src-max-width { max-width: 47% !important; } #u_content_text_4 .v-line-height { line-height: 130% !important; } }</style> |
39 | + <!--[if !mso]><!--> |
40 | + <link href="https://fonts.googleapis.com/css?family=Lato:400,700&display=swap" rel="stylesheet" type="text/css" /> |
41 | + <!--<![endif]--> |
42 | + </head> |
43 | + <body class="clean-body u_body" style="margin: 0;padding: 0;-webkit-text-size-adjust: 100%;background-color: #c9c9c9;color: #000000"> |
44 | + <!--[if IE]><div class="ie-container"><![endif]--> |
45 | + <!--[if mso]><div class="mso-container"><![endif]--> |
46 | + <table id="u_body" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: #c9c9c9;width:100%" cellpadding="0" cellspacing="0"> |
47 | + <tbody> |
48 | + <tr style="vertical-align: top"> |
49 | + <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top"> |
50 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #c9c9c9;"><![endif]--> |
51 | + <div class="u-row-container" style="padding: 0px;background-color: #c9c9c9"> |
52 | + <div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #c9c9c9;"> |
53 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
54 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: #c9c9c9;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #c9c9c9;"><![endif]--> |
55 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
56 | + <div class="u-col u-col-100" style="max-width: 320px;min-width: 600px;display: table-cell;vertical-align: top;"> |
57 | + <div style="height: 100%;width: 100% !important;"> |
58 | + <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG></o> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> |
59 | + <div style="height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"> |
60 | + <!--[if !mso]><!--> |
61 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
62 | + <tbody> |
63 | + <tr> |
64 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:15px;font-family:'Lato',sans-serif;" align="left"> |
65 | + <table height="0px" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;border-top: 1px solid #c9c9c9;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%"> |
66 | + <tbody> |
67 | + <tr style="vertical-align: top"> |
68 | + <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top;font-size: 0px;line-height: 0px;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%"> |
69 | + <span> </span> |
70 | + </td> |
71 | + </tr> |
72 | + </tbody> |
73 | + </table> |
74 | + </td> |
75 | + </tr> |
76 | + </tbody> |
77 | + </table> |
78 | + <!--<![endif]--> |
79 | + </div> |
80 | + <!--[if !mso]><!--> |
81 | + </div> |
82 | + </div> |
83 | + <!--<![endif]--> |
84 | + <!--[if IE]><div class="ie-container"><![endif]--> |
85 | + </div> |
86 | + </div> |
87 | + </div> |
88 | + <div class="u-row-container" style="padding: 0px;background-color: transparent"> |
89 | + <div class="u-row" style="box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%);Margin: 0 auto;min-width: 320px;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #eeeeee;box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%); border-bottom: 2px solid rgba(0, 0, 0, 0.125);"> |
90 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
91 | + <!--[if mso]><div class="mso-container"><![endif]--> |
92 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #c9c9c9;"><![endif]--> |
93 | + <div class="u-col u-col-100" style="max-width: 320px;min-width: 600px;display: table-cell;vertical-align: top;"> |
94 | + <div style="height: 100%;width: 100% !important;"> |
95 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: #c9c9c9;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #c9c9c9;"><![endif]--> |
96 | + <div style="height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"> |
97 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
98 | + <table id="u_content_image_1" style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
99 | + <tbody> |
100 | + <tr> |
101 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:25px 10px;font-family:'Lato',sans-serif;" align="left"> |
102 | + <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
103 | + <tr> |
104 | + <td style="padding-right: 0px;padding-left: 0px;" align="center"> |
105 | + <a href="${baseUrl}" target="_blank"> |
106 | + <img align="center" border="0" src="${logo}" alt="${baseName}" title="30GBServices" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: inline-block !important;border: none;height: auto;float: none;width: 34%;max-width: 197.2px;" width="197.2" class="v-src-width v-src-max-width" /> |
107 | + </a> |
108 | + </td> |
109 | + </tr> |
110 | + </table> |
111 | + </td> |
112 | + </tr> |
113 | + </tbody> |
114 | + </table> |
115 | + <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG></o> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> |
116 | + </div> |
117 | + <!--[if !mso]><!--> |
118 | + </div> |
119 | + </div> |
120 | + <!--<![endif]--> |
121 | + <!--[if !mso]><!--> |
122 | + </div> |
123 | + </div> |
124 | + </div> |
125 | + <div class="u-row-container" style="padding: 0px;background-color: transparent"> |
126 | + <div class="u-row" style="box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%);Margin: 0 auto;min-width: 320px;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #ffffff;"> |
127 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
128 | + <!--<![endif]--> |
129 | + <!--[if IE]><div class="ie-container"><![endif]--> |
130 | + <div class="u-col u-col-100" style="max-width: 320px;min-width: 600px;display: table-cell;vertical-align: top;"> |
131 | + <div style="height: 100%;width: 100% !important;"> |
132 | + <!--[if mso]><div class="mso-container"><![endif]--> |
133 | + <div style="height: 100%; padding: 0px;border-top: 0px dashed transparent;border-left: 0px dashed transparent;border-right: 0px dashed transparent;border-bottom: 0px dashed transparent;"> |
134 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #c9c9c9;"><![endif]--> |
135 | + <table id="u_content_text_4" style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
136 | + <tbody> |
137 | + <tr> |
138 | + <td style="overflow-wrap:break-word;padding:40px 40px 30px;font-family:'Lato',sans-serif;word-break: break-all; word-wrap: break-word;" align="left"> |
139 | + <div class="v-line-height" style="line-height: 180%; text-align: left; word-wrap: break-word;margin-right:10%"> |
140 | + <p style="font-size: 14px; line-height: 180%;">Hi |
141 | + <b>${name} ${surname}</b>,</p> |
142 | + <p style="font-size: 12px; line-height: 180%;">Congratulations, and thank you for your registration as an AFFILIATE.</p> |
143 | + <p style="font-size: 12px; line-height: 180%;word-break: break-all; word-wrap: break-word;"> |
144 | + <br />Please confirm your E-mail address by going to the following URL: |
145 | + <br /> |
146 | + <a href="${link}">${link}</a> |
147 | + </p> |
148 | + <p style="font-size: 12px; line-height: 180%;"> |
149 | + <br />* In future, you will be asked for your E-mail and password before logging into the website</p> |
150 | + <p style="font-size: 12px; line-height: 180%;">* Keep your password safe.</p> |
151 | + <p style="font-size: 12px; line-height: 180%;"></p> |
152 | + <p style="font-size: 12px; line-height: 180%;">You can login anytime as a Subscriber, or Affiliate at the |
153 | + <a href="${baseUrl}/login">login page</a>.</p> |
154 | + </div> |
155 | + </td> |
156 | + </tr> |
157 | + </tbody> |
158 | + </table> |
159 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
160 | + <tbody> |
161 | + <tr> |
162 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:0px 40px;font-family:'Lato',sans-serif;" align="left"> |
163 | + <div align="left"> |
164 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: #c9c9c9;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #c9c9c9;"><![endif]--> |
165 | + <a href="${link}" target="_blank" style="box-sizing: border-box;display: inline-block;font-family:'Lato',sans-serif;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #199013; border-radius: 5px;-webkit-border-radius: 5px; -moz-border-radius: 5px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none; box-shadow: 0 0 2px 1px rgba(0,0,0,0.6);"> |
166 | + <span class="v-line-height" style="display:block;padding:10px 20px;line-height:120%;"> |
167 | + <span style="font-size: 18px; line-height: 21.6px;">Verify E-Mail</span> |
168 | + </span> |
169 | + </a> |
170 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
171 | + </div> |
172 | + </td> |
173 | + </tr> |
174 | + </tbody> |
175 | + </table> |
176 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
177 | + <tbody> |
178 | + <tr> |
179 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:40px 40px 30px;font-family:'Lato',sans-serif;" align="left"> |
180 | + <div class="v-line-height" style="line-height: 140%; text-align: left; word-wrap: break-word;"> |
181 | + <p style="font-size: 14px; line-height: 140%;"> |
182 | + <span style="color: #888888; font-size: 14px; line-height: 19.6px;"> |
183 | + <em> |
184 | + <span style="font-size: 16px; line-height: 22.4px;">Please ignore this email if you did not recently register with us</span> |
185 | + </em> |
186 | + </span> |
187 | + <br /> |
188 | + <span style="color: #888888; font-size: 14px; line-height: 19.6px;"> |
189 | + <em> |
190 | + <span style="font-size: 16px; line-height: 22.4px;"> </span> |
191 | + </em> |
192 | + </span> |
193 | + </p> |
194 | + </div> |
195 | + </td> |
196 | + </tr> |
197 | + </tbody> |
198 | + </table> |
199 | + <div class="u-row-container" style="padding: 0px;background-color: transparent"> |
200 | + <div class="u-row" style="box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%);Margin: 0 auto;min-width: 100%;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #eeeeee; padding-bottom:10px;border-top: 2px solid rgba(0, 0, 0, 0.125);"> |
201 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
202 | + <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG></o> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> |
203 | + <!--[if !mso]><!--> |
204 | + <div class="u-col u-col-50" style="max-width: 320px;min-width: 300px;display: table-cell;vertical-align: top;"> |
205 | + <div style="height: 100%;width: 100% !important;"> |
206 | + <!--<![endif]--> |
207 | + <div style="height: 100%; padding: 7px 20px 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"> |
208 | + <!--[if !mso]><!--> |
209 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
210 | + <tbody> |
211 | + <tr> |
212 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:'Lato',sans-serif;" align="left"> |
213 | + <div class="v-line-height" style="line-height: 140%; text-align: left; word-wrap: break-word;"> |
214 | + <p style="font-size: 14px; line-height: 140%;"> |
215 | + <span style="font-size: 12px; line-height: 16.8px; color: #000000;">${from}</span> |
216 | + </p> |
217 | + <p style="font-size: 14px; line-height: 140%;"> |
218 | + <span style="font-size: 12px; line-height: 16.8px; color: #000000;">© All Rights Reserved</span> |
219 | + </p> |
220 | + </div> |
221 | + </td> |
222 | + </tr> |
223 | + </tbody> |
224 | + </table> |
225 | + <!--<![endif]--> |
226 | + </div> |
227 | + <!--[if IE]><div class="ie-container"><![endif]--> |
228 | + </div> |
229 | + </div> |
230 | + <!--[if mso]><div class="mso-container"><![endif]--> |
231 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #c9c9c9;"><![endif]--> |
232 | + </div> |
233 | + </div> |
234 | + </div> |
235 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: #c9c9c9;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #c9c9c9;"><![endif]--> |
236 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
237 | + </div> |
238 | + </div> |
239 | + </div> |
240 | + </td> |
241 | + </tr> |
242 | + </tbody> |
243 | + </table> |
244 | + <table id="u_body" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: #c9c9c9;width:100%" cellpadding="0" cellspacing="0"> |
245 | + <tbody> |
246 | + <tr style="vertical-align: top"> |
247 | + <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top"> |
248 | + <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG></o> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> |
249 | + <div class="u-row-container" style="padding: 0px;background-color: #c9c9c9"> |
250 | + <div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #c9c9c9;"> |
251 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
252 | + <!--[if !mso]><!--> |
253 | + <!--<![endif]--> |
254 | + <div class="u-col u-col-100" style="max-width: 320px;min-width: 600px;display: table-cell;vertical-align: top;"> |
255 | + <div style="height: 100%;width: 100% !important;"> |
256 | + <!--[if !mso]><!--> |
257 | + <div style="height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"> |
258 | + <!--<![endif]--> |
259 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
260 | + <tbody> |
261 | + <tr> |
262 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:15px;font-family:'Lato',sans-serif;" align="left"> |
263 | + <table height="0px" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;border-top: 1px solid #c9c9c9;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%"> |
264 | + <tbody> |
265 | + <tr style="vertical-align: top"> |
266 | + <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top;font-size: 0px;line-height: 0px;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%"> |
267 | + <span> </span> |
268 | + </td> |
269 | + </tr> |
270 | + </tbody> |
271 | + </table> |
272 | + </td> |
273 | + </tr> |
274 | + </tbody> |
275 | + </table> |
276 | + <!--[if IE]><div class="ie-container"><![endif]--> |
277 | + </div> |
278 | + <!--[if mso]><div class="mso-container"><![endif]--> |
279 | + </div> |
280 | + </div> |
281 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #c9c9c9;"><![endif]--> |
282 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: #c9c9c9;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #c9c9c9;"><![endif]--> |
283 | + </div> |
284 | + </div> |
285 | + </div> |
286 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
287 | + <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG></o> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> |
288 | + </body> |
289 | + </html> |
290 | diff --git a/config/templates/user-register.html b/config/templates/user-register.html |
291 | new file mode 100644 |
292 | index 0000000..bdedac4 |
293 | --- /dev/null |
294 | +++ b/config/templates/user-register.html |
295 | @@ -0,0 +1,251 @@ |
296 | +<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional //EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
297 | +<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" style=" background-color: #c9c9c9"> |
298 | + |
299 | +<head> |
300 | + <!--[if gte mso 9]> <xml> <o:OfficeDocumentSettings> <o:AllowPNG/> <o:PixelsPerInch>96</o:PixelsPerInch> </o:OfficeDocumentSettings> </xml> <![endif]--> |
301 | + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
302 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
303 | + <meta name="x-apple-disable-message-reformatting"> |
304 | + <!--[if !mso]><!--> |
305 | + <meta http-equiv="X-UA-Compatible" content="IE=edge"> |
306 | + <!--<![endif]--> |
307 | + <title></title> |
308 | + <style type="text/css"> |
309 | + @media only screen and (min-width: 620px) { .u-row { width: 600px !important; } .u-row .u-col { vertical-align: top; } .u-row .u-col-50 { width: 300px !important; } .u-row .u-col-100 { width: 600px !important; } } @media (max-width: 620px) { .u-row-container { max-width: 100% !important; padding-left: 0px !important; padding-right: 0px !important; } .u-row .u-col { min-width: 320px !important; max-width: 100% !important; display: block !important; } .u-row { width: calc(100% - 40px) !important; } .u-col { width: 100% !important; } .u-col > div { margin: 0 auto; } } body { margin: 0; padding: 0; } table, tr, td { vertical-align: top; border-collapse: collapse; } p { margin: 0; } .ie-container table, .mso-container table { table-layout: fixed; } * { line-height: inherit; } a[x-apple-data-detectors='true'] { color: inherit !important; text-decoration: none !important; } table, td { color: #000000; } #u_body a { color: #03ff; text-decoration: underline; } @media (max-width: 480px) { #u_content_image_1 .v-src-width { width: auto !important; } #u_content_image_1 .v-src-max-width { max-width: 47% !important; } #u_content_text_4 .v-line-height { line-height: 130% !important; } } |
310 | + </style> |
311 | + <!--[if !mso]><!--> |
312 | + <link href="https://fonts.googleapis.com/css?family=Lato:400,700&display=swap" rel="stylesheet" type="text/css"> |
313 | + <!--<![endif]--> |
314 | +</head> |
315 | + |
316 | +<body class="clean-body u_body" style="margin: 0;padding: 0;-webkit-text-size-adjust: 100%;background-color: #c9c9c9;color: #000000"> |
317 | + <!--[if IE]><div class="ie-container"><![endif]--> |
318 | + <!--[if mso]><div class="mso-container"><![endif]--> |
319 | + <table id="u_body" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: #c9c9c9;width:100%" cellpadding="0" cellspacing="0"> |
320 | + <tbody> |
321 | + <tr style="vertical-align: top"> |
322 | + <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top"> |
323 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #c9c9c9;"><![endif]--> |
324 | + <div class="u-row-container" style="padding: 0px;background-color: #c9c9c9"> |
325 | + <div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #c9c9c9;"> |
326 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
327 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: #c9c9c9;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #c9c9c9;"><![endif]--> |
328 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
329 | + <div class="u-col u-col-100" style="max-width: 320px;min-width: 600px;display: table-cell;vertical-align: top;"> |
330 | + <div style="height: 100%;width: 100% !important;"> |
331 | + <!--[if (!mso)&(!IE)]><!--> |
332 | + <div style="height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"> |
333 | + <!--<![endif]--> |
334 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
335 | + <tbody> |
336 | + <tr> |
337 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:15px;font-family:'Lato',sans-serif;" align="left"> |
338 | + <table height="0px" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;border-top: 1px solid #c9c9c9;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%"> |
339 | + <tbody> |
340 | + <tr style="vertical-align: top"> |
341 | + <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top;font-size: 0px;line-height: 0px;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%"> <span> </span> </td> |
342 | + </tr> |
343 | + </tbody> |
344 | + </table> |
345 | + </td> |
346 | + </tr> |
347 | + </tbody> |
348 | + </table> |
349 | + <!--[if (!mso)&(!IE)]><!--> |
350 | + </div> |
351 | + <!--<![endif]--> |
352 | + </div> |
353 | + </div> |
354 | + <!--[if (mso)|(IE)]></td><![endif]--> |
355 | + <!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]--> |
356 | + </div> |
357 | + </div> |
358 | + </div> |
359 | + <div class="u-row-container" style="padding: 0px;background-color: transparent"> |
360 | + <div class="u-row" style="box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%);Margin: 0 auto;min-width: 320px;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #eeeeee;box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%); border-bottom: 2px solid rgba(0, 0, 0, 0.125);"> |
361 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
362 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #ffffff;"><![endif]--> |
363 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
364 | + <div class="u-col u-col-100" style="max-width: 320px;min-width: 600px;display: table-cell;vertical-align: top;"> |
365 | + <div style="height: 100%;width: 100% !important;"> |
366 | + <!--[if (!mso)&(!IE)]><!--> |
367 | + <div style="height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"> |
368 | + <!--<![endif]--> |
369 | + <table id="u_content_image_1" style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
370 | + <tbody> |
371 | + <tr> |
372 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:25px 10px;font-family:'Lato',sans-serif;" align="left"> |
373 | + <table width="100%" cellpadding="0" cellspacing="0" border="0"> |
374 | + <tr> |
375 | + <td style="padding-right: 0px;padding-left: 0px;" align="center"> |
376 | + <a href="${baseUrl}" target="_blank"> <img align="center" border="0" src="${logo}" alt="${baseName}" title="30GBServices" style="outline: none;text-decoration: none;-ms-interpolation-mode: bicubic;clear: both;display: inline-block !important;border: none;height: auto;float: none;width: 34%;max-width: 197.2px;" width="197.2" class="v-src-width v-src-max-width" /> </a> |
377 | + </td> |
378 | + </tr> |
379 | + </table> |
380 | + </td> |
381 | + </tr> |
382 | + </tbody> |
383 | + </table> |
384 | + <!--[if (!mso)&(!IE)]><!--> |
385 | + </div> |
386 | + <!--<![endif]--> |
387 | + </div> |
388 | + </div> |
389 | + <!--[if (mso)|(IE)]></td><![endif]--> |
390 | + <!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]--> |
391 | + </div> |
392 | + </div> |
393 | + </div> |
394 | + <div class="u-row-container" style="padding: 0px;background-color: transparent"> |
395 | + <div class="u-row" style="box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%);Margin: 0 auto;min-width: 320px;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #ffffff;"> |
396 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
397 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #ffffff;"><![endif]--> |
398 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px dashed transparent;border-left: 0px dashed transparent;border-right: 0px dashed transparent;border-bottom: 0px dashed transparent;" valign="top"><![endif]--> |
399 | + <div class="u-col u-col-100" style="max-width: 320px;min-width: 600px;display: table-cell;vertical-align: top;"> |
400 | + <div style="height: 100%;width: 100% !important;"> |
401 | + <!--[if (!mso)&(!IE)]><!--> |
402 | + <div style="height: 100%; padding: 0px;border-top: 0px dashed transparent;border-left: 0px dashed transparent;border-right: 0px dashed transparent;border-bottom: 0px dashed transparent;"> |
403 | + <!--<![endif]--> |
404 | + <table id="u_content_text_4" style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
405 | + <tbody> |
406 | + <tr> |
407 | + <td style="overflow-wrap:break-word;padding:40px 40px 30px;font-family:'Lato',sans-serif;word-break: break-all; word-wrap: break-word;" align="left"> |
408 | + <div class="v-line-height" style="line-height: 180%; text-align: left; word-wrap: break-word;margin-right:10%"> |
409 | + <p style="font-size: 14px; line-height: 180%;">Hi <b>${name} ${surname}</b>,</p> |
410 | + <p style="font-size: 12px; line-height: 180%;">Congratulations, and thank you for your registration.</p> |
411 | + <p style="font-size: 12px; line-height: 180%;word-break: break-all; word-wrap: break-word;"><br />Please confirm your E-mail address by going to the following URL:<br /><a href="${link}">${link}</a></p> |
412 | + <p style="font-size: 12px; line-height: 180%;"><br />* In future, you will be asked for your E-mail and password before logging into the website</p> |
413 | + <p style="font-size: 12px; line-height: 180%;">* Keep your password safe.</p> |
414 | + <p style="font-size: 12px; line-height: 180%;"> </p> |
415 | + <p style="font-size: 12px; line-height: 180%;">You can login to the website anytime at the login page.</p> |
416 | + </div> |
417 | + </td> |
418 | + </tr> |
419 | + </tbody> |
420 | + </table> |
421 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
422 | + <tbody> |
423 | + <tr> |
424 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:0px 40px;font-family:'Lato',sans-serif;" align="left"> |
425 | + <div align="left"> |
426 | + <!--[if mso]><div class="mso-container"><![endif]--> |
427 | + <a href="${link}" target="_blank" style="box-sizing: border-box;display: inline-block;font-family:'Lato',sans-serif;text-decoration: none;-webkit-text-size-adjust: none;text-align: center;color: #FFFFFF; background-color: #199013; border-radius: 5px;-webkit-border-radius: 5px; -moz-border-radius: 5px; width:auto; max-width:100%; overflow-wrap: break-word; word-break: break-word; word-wrap:break-word; mso-border-alt: none; box-shadow: 0 0 2px 1px rgba(0,0,0,0.6);"> |
428 | + <span class="v-line-height" style="display:block;padding:10px 20px;line-height:120%;"> |
429 | + <span style="font-size: 18px; line-height: 21.6px;">Verify E-Mail</span> |
430 | + </span> |
431 | + </a> |
432 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #f9f9f9;"><![endif]--> |
433 | + </div> |
434 | + </td> |
435 | + </tr> |
436 | + </tbody> |
437 | + </table> |
438 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
439 | + <tbody> |
440 | + <tr> |
441 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:40px 40px 30px;font-family:'Lato',sans-serif;" align="left"> |
442 | + <div class="v-line-height" style="line-height: 140%; text-align: left; word-wrap: break-word;"> |
443 | + <p style="font-size: 14px; line-height: 140%;"> |
444 | + <span style="color: #888888; font-size: 14px; line-height: 19.6px;"> |
445 | + <em> |
446 | + <span style="font-size: 16px; line-height: 22.4px;">Please ignore this email if you did not recently register with us</span> |
447 | + </em> |
448 | + </span> |
449 | + <br /> |
450 | + <span style="color: #888888; font-size: 14px; line-height: 19.6px;"> |
451 | + <em> |
452 | + <span style="font-size: 16px; line-height: 22.4px;"> </span> |
453 | + </em> |
454 | + </span> |
455 | + </p> |
456 | + </div> |
457 | + </td> |
458 | + </tr> |
459 | + </tbody> |
460 | + </table> |
461 | + <div class="u-row-container" style="padding: 0px;background-color: transparent"> |
462 | + <div class="u-row" style="box-shadow: 0px 0px 10px 0px rgb(0 0 0 / 10%);Margin: 0 auto;min-width: 100%;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #eeeeee; padding-bottom:10px;border-top: 2px solid rgba(0, 0, 0, 0.125);"> |
463 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
464 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: transparent;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #eeeeee;"><![endif]--> |
465 | + <!--[if (mso)|(IE)]><td align="center" width="300" style="width: 300px;padding: 20px 20px 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
466 | + <div class="u-col u-col-50" style="max-width: 320px;min-width: 300px;display: table-cell;vertical-align: top;"> |
467 | + <div style="height: 100%;width: 100% !important;"> |
468 | + <!--[if (!mso)&(!IE)]><!--> |
469 | + <div style="height: 100%; padding: 7px 20px 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"> |
470 | + <!--<![endif]--> |
471 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
472 | + <tbody> |
473 | + <tr> |
474 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:10px;font-family:'Lato',sans-serif;" align="left"> |
475 | + <div class="v-line-height" style="line-height: 140%; text-align: left; word-wrap: break-word;"> |
476 | + <p style="font-size: 14px; line-height: 140%;"><span style="font-size: 12px; line-height: 16.8px; color: #000000;">${from}</span></p> |
477 | + <p style="font-size: 14px; line-height: 140%;"><span style="font-size: 12px; line-height: 16.8px; color: #000000;">© All Rights Reserved</span></p> |
478 | + </div> |
479 | + </td> |
480 | + </tr> |
481 | + </tbody> |
482 | + </table> |
483 | + <!--[if (!mso)&(!IE)]><!--> |
484 | + </div> |
485 | + <!--<![endif]--> |
486 | + </div> |
487 | + </div> |
488 | + <!--[if (mso)|(IE)]></td><![endif]--> |
489 | + <!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]--> |
490 | + </div> |
491 | + </div> |
492 | + </div> |
493 | + <!--[if (mso)|(IE)]></td><![endif]--> |
494 | + <!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]--> |
495 | + </div> |
496 | + </div> |
497 | + </div> |
498 | + </td> |
499 | + </tr> |
500 | + </tbody> |
501 | + </table> |
502 | + <table id="u_body" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;min-width: 320px;Margin: 0 auto;background-color: #c9c9c9;width:100%" cellpadding="0" cellspacing="0"> |
503 | + <tbody> |
504 | + <tr style="vertical-align: top"> |
505 | + <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top"> |
506 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color: #c9c9c9;"><![endif]--> |
507 | + <div class="u-row-container" style="padding: 0px;background-color: #c9c9c9"> |
508 | + <div class="u-row" style="margin: 0 auto;min-width: 320px;max-width: 600px;overflow-wrap: break-word;word-wrap: break-word;word-break: break-word;background-color: #c9c9c9;"> |
509 | + <div style="border-collapse: collapse;display: table;width: 100%;height: 100%;background-color: transparent;"> |
510 | + <!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0px;background-color: #c9c9c9;" align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:600px;"><tr style="background-color: #c9c9c9;"><![endif]--> |
511 | + <!--[if (mso)|(IE)]><td align="center" width="600" style="width: 600px;padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;" valign="top"><![endif]--> |
512 | + <div class="u-col u-col-100" style="max-width: 320px;min-width: 600px;display: table-cell;vertical-align: top;"> |
513 | + <div style="height: 100%;width: 100% !important;"> |
514 | + <!--[if (!mso)&(!IE)]><!--> |
515 | + <div style="height: 100%; padding: 0px;border-top: 0px solid transparent;border-left: 0px solid transparent;border-right: 0px solid transparent;border-bottom: 0px solid transparent;"> |
516 | + <!--<![endif]--> |
517 | + <table style="font-family:'Lato',sans-serif;" role="presentation" cellpadding="0" cellspacing="0" width="100%" border="0"> |
518 | + <tbody> |
519 | + <tr> |
520 | + <td style="overflow-wrap:break-word;word-break:break-word;padding:15px;font-family:'Lato',sans-serif;" align="left"> |
521 | + <table height="0px" align="center" border="0" cellpadding="0" cellspacing="0" width="100%" style="border-collapse: collapse;table-layout: fixed;border-spacing: 0;mso-table-lspace: 0pt;mso-table-rspace: 0pt;vertical-align: top;border-top: 1px solid #c9c9c9;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%"> |
522 | + <tbody> |
523 | + <tr style="vertical-align: top"> |
524 | + <td style="word-break: break-word;border-collapse: collapse !important;vertical-align: top;font-size: 0px;line-height: 0px;mso-line-height-rule: exactly;-ms-text-size-adjust: 100%;-webkit-text-size-adjust: 100%"> <span> </span> </td> |
525 | + </tr> |
526 | + </tbody> |
527 | + </table> |
528 | + </td> |
529 | + </tr> |
530 | + </tbody> |
531 | + </table> |
532 | + <!--[if (!mso)&(!IE)]><!--> |
533 | + </div> |
534 | + <!--<![endif]--> |
535 | + </div> |
536 | + </div> |
537 | + <!--[if (mso)|(IE)]></td><![endif]--> |
538 | + <!--[if (mso)|(IE)]></tr></table></td></tr></table><![endif]--> |
539 | + </div> |
540 | + </div> |
541 | + </div> |
542 | + <!--[if mso]></div><![endif]--> |
543 | + <!--[if IE]></div><![endif]--> |
544 | +</body> |
545 | + |
546 | +</html> |
547 | diff --git a/methods/main.js b/methods/main.js |
548 | index dfde0a0..fa590eb 100644 |
549 | --- a/methods/main.js |
550 | +++ b/methods/main.js |
551 | @@ -1,9 +1,10 @@ |
552 | |
553 | const Client = require('../models/client'); |
554 | -const Template = require('../models/template'); |
555 | const nodemailer = require('nodemailer'); |
556 | const { mkConfig, mkMail } = require('./mkMail'); |
557 | const { updateClients, updateTemplates, singleClient } = require('./updateDB'); |
558 | +const fs = require('fs'); |
559 | +const path = require('path'); |
560 | require('colors'); |
561 | |
562 | const getClient = (name, token) => { |
563 | @@ -18,82 +19,64 @@ const getTemplate = async (name, token, type) => { |
564 | const client = await getClient(name, token); |
565 | if(!client) return false; |
566 | |
567 | - const template = await Template.findOne({ client: client._id}); |
568 | + const template = await fs.existsSync(path.join(__dirname, `../config/templates/${type}.html`) ? path.join(__dirname, `../config/templates/${type}.html`) : null); |
569 | if(!template) return false; |
570 | |
571 | - const html = template.emails.find(e => e.name === type).html; |
572 | - if(!html) return false; |
573 | - |
574 | - const requires = template.emails.find(e => e.name === type).requires; |
575 | - if(!requires) return false; |
576 | - |
577 | - return { html, requires }; |
578 | - |
579 | + return await fs.readFileSync(path.join(__dirname, `../config/templates/${type}.html`), 'utf8'); |
580 | } |
581 | |
582 | const mail = async (recipient, link, name, token, type) => { |
583 | |
584 | - const { html, requires } = await getTemplate(name, token, type); |
585 | - if(!html || !requires) return false; |
586 | + let html = await getTemplate(name, token, type); |
587 | + if(!html) return console.log('No template found'.red); |
588 | + else console.log('Template found'.green); |
589 | |
590 | const client = await getClient(name, token); |
591 | - if(!client) return false; |
592 | + if(!client) return console.log('No client found'.red); |
593 | + else console.log('Client found'.green); |
594 | |
595 | const transporter = nodemailer.createTransport(client.config); |
596 | - if(!transporter) return false; |
597 | - |
598 | - const inputs = mkConfig(client, recipient, link); |
599 | - if(!inputs) return false; |
600 | - |
601 | - const mail = mkMail(client, type, inputs); |
602 | - if(!mail) return false; |
603 | - |
604 | - const { from, to, subject, Html } = mail; |
605 | - if(!from || !to || !subject || !Html) return false; |
606 | - |
607 | - const info = await transporter.sendMail({ from, to, subject, html: Html }); |
608 | - if(!info) return false; |
609 | - |
610 | - console.log(`Message sent: ${info.messageId}`.green); |
611 | + if(!transporter) return console.log('No transporter found'.red); |
612 | + else console.log('Transporter found'.green); |
613 | |
614 | - for(var obj in info) { |
615 | - Object.keys(info[obj]).forEach(key => { |
616 | - console.log(key.green + ': ' + info[obj][key]); |
617 | - }); |
618 | - } |
619 | - return info; |
620 | -} |
621 | + const inputs = await mkConfig(client, recipient, link); |
622 | + if(!inputs) return console.log('No inputs found'.red); |
623 | + else console.log('Inputs found'.green); |
624 | |
625 | -const test = async (recipient, link, name, token, type) => { |
626 | + const mail = await mkMail(client, type, inputs); |
627 | + if(!mail) return console.log('No mail found'.red); |
628 | + else console.log('Mail found'.green); |
629 | |
630 | - console.log('TESTING'.cyan + ` ${type}`.yellow + ' EMAIL'.cyan); |
631 | + let { from, to, subject, Html } = mail; |
632 | + if(!from || !to || !subject || !Html) return console.log('No mail found'.red); |
633 | + else console.log('Mail found'.green); |
634 | |
635 | - const { html, requires } = await getTemplate(name, token, type); |
636 | - if(!html || !requires) return console.log('No template found'.red); |
637 | + html = Html; |
638 | + from = from.replace(/:/g, ''); |
639 | |
640 | - const client = await getClient(name, token); |
641 | - if(!client) return console.log('No client found'.red); |
642 | + const mailOptions = { from, to, subject, html }; |
643 | |
644 | - const transporter = nodemailer.createTransport(client.config); |
645 | - if(!transporter) return console.log('No transporter found'.red); |
646 | + console.log(mailOptions); |
647 | + console.log('Sending mail...'.yellow); |
648 | + console.log(`transporter: ${client.config}`.yellow); |
649 | |
650 | - const inputs = mkConfig(client, recipient, link); |
651 | - if(!inputs) return console.log('No inputs found'.red); |
652 | |
653 | - const mail = mkMail(client, type, inputs); |
654 | - if(!mail) return console.log('No mail found'.red); |
655 | |
656 | - const { from, to, subject, Html } = mail; |
657 | - if(!from || !to || !subject || !Html) return console.log('No mail found'.red); |
658 | + await transporter.sendMail(mailOptions, (err, info) => { |
659 | + if(err) return console.log(err); |
660 | + console.log(info); |
661 | + }); |
662 | |
663 | - console.log('From: '.green + from); |
664 | - console.log('To: '.green + to); |
665 | - console.log('Subject: '.green + subject); |
666 | - console.log('Html: '.green + Html); |
667 | + console.log(Object.keys(mail).forEach(key => console.log(key, mail[key]))); |
668 | |
669 | + await fs.writeFileSync(path.join(__dirname, `../outbox/${type}.json`), { mailinfo: JSON.stringify(mail, null, 2), timestamp: Date.now() }); |
670 | return true; |
671 | +} |
672 | |
673 | +const test = async (recipient, link, name, token, type) => { |
674 | + await mail(recipient, link, name, token, type); |
675 | } |
676 | |
677 | -module.exports = { getClient, getTemplate, mail, test, updateClients, updateTemplates, singleClient }; |
678 | + |
679 | +module.exports = { getClient, getTemplate, mail, test }; |
680 | |
681 | diff --git a/methods/mkMail.js b/methods/mkMail.js |
682 | index 49cab08..5f716dc 100644 |
683 | --- a/methods/mkMail.js |
684 | +++ b/methods/mkMail.js |
685 | @@ -1,5 +1,9 @@ |
686 | |
687 | -const Template = require('../models/template'); |
688 | +const fs = require('fs'); |
689 | +const path = require('path'); |
690 | +const Templates = fs.readdirSync(path.join(__dirname, '..', 'config', 'templates')).map((file) => { |
691 | + return file.replace('.html', ''); |
692 | +}); |
693 | |
694 | const mkConfig = (client, recipient, link) => { |
695 | |
696 | @@ -7,7 +11,7 @@ const mkConfig = (client, recipient, link) => { |
697 | |
698 | try { |
699 | if (client.name == 'FREEPAID') { |
700 | - let { name, surname, agency } = recipient, |
701 | + let { name, surname, agency, email } = recipient, |
702 | logo, baseName = recipient.agency.replace(/^/, 'https://').replace(/https?:\/\//g, '').replace(/\/$/, ''), |
703 | from = baseName.slice(0, 1).toString().toUpperCase() + baseName.slice(1).split('.')[0].replace('data', ' Data').replace('gbservices', 'GB Services'), |
704 | subject = `Welcome to the ${from} family!`, baseUrl = agency.replace(/https?:\/\//g, '').replace(/^/, 'https://'); |
705 | @@ -15,7 +19,7 @@ const mkConfig = (client, recipient, link) => { |
706 | logo = baseName + '.png'; |
707 | logo = `${baseUrl}/img/logos/${logo}`; |
708 | |
709 | - return { from, subject, name, surname, logo, link, baseUrl, agency, baseName }; |
710 | + return { from, subject, name, surname, logo, link, baseUrl, agency, baseName, email }; |
711 | |
712 | } else if (client.name == 'CONCISE') { |
713 | |
714 | @@ -34,54 +38,27 @@ const mkMail = async (client, type, inputs) => { |
715 | console.log(`\nMKMAIL STARTED FOR ${client.name}\nTYPE:${type}\n`); |
716 | |
717 | try { |
718 | - if (client.name == 'FREEPAID') { |
719 | - |
720 | - const templates = await Template.findOne({ client: client._id }); |
721 | - const { from, subject, name, surname, logo, link, baseUrl, agency, baseName } = inputs; |
722 | - |
723 | - if(type == 'user-register') { |
724 | - |
725 | - const template = templates.find(t => t.name == 'user-register'); |
726 | - if (!template) return false; |
727 | - |
728 | - const html = template.html.replace(/\${name}/g, name) |
729 | - .replace(/\${surname}/g, surname) |
730 | - .replace(/\${logo}/g, logo) |
731 | - .replace(/\${link}/g, link) |
732 | - .replace(/\${baseUrl}/g, baseUrl) |
733 | - .replace(/\${agency}/g, agency) |
734 | - .replace(/\${baseName}/g, baseName) |
735 | - .replace(/\${from}/g, from); |
736 | - |
737 | - const to = `${from} <${client.sender}>`; |
738 | - |
739 | - return { from, to, subject, Html: html }; |
740 | - |
741 | - } else if (type == 'affiliate-register') { |
742 | - |
743 | - const template = templates.find(t => t.name == 'affiliate-register'); |
744 | - if (!template) return false; |
745 | + const templates = Templates || []; |
746 | + if (!templates) { |
747 | + console.log('NO TEMPLATES FOUND'); |
748 | + return; |
749 | + } |
750 | |
751 | - const html = template.html.replace(/\${name}/g, name) |
752 | - .replace(/\${surname}/g, surname) |
753 | - .replace(/\${logo}/g, logo) |
754 | - .replace(/\${link}/g, link) |
755 | - .replace(/\${baseUrl}/g, baseUrl) |
756 | - .replace(/\${agency}/g, agency) |
757 | - .replace(/\${baseName}/g, baseName) |
758 | - .replace(/\${from}/g, from); |
759 | + let { from, subject, name, surname, logo, link, baseUrl, agency, baseName, email } = inputs; |
760 | |
761 | - const to = `${from} <${client.sender}>`; |
762 | + console.log(JSON.parse(JSON.stringify(templates))); |
763 | |
764 | - return { from, to, subject, Html: html }; |
765 | + let temp = await fs.readFileSync(path.join(__dirname, '..', 'config', 'templates', `${type}.html`), 'utf8'); |
766 | |
767 | + for (let key in inputs) { |
768 | + temp = temp.replace('${' + key + '}', inputs[key]); |
769 | + console.log(`\nREPLACING {{${key}}} WITH ${inputs[key]}`); |
770 | } |
771 | |
772 | - } else if (client.name == 'CONCISE') { |
773 | + const to = email; |
774 | + from = `${from} <${client.sender}>`; |
775 | |
776 | - return |
777 | - |
778 | - } |
779 | + return { from, to, subject, Html: temp }; |
780 | |
781 | } catch (err) { |
782 | console.log(err); |
783 | @@ -89,5 +66,6 @@ const mkMail = async (client, type, inputs) => { |
784 | |
785 | } |
786 | |
787 | + |
788 | module.exports = { mkConfig, mkMail }; |
789 | |
790 | diff --git a/methods/updateDB.js b/methods/updateDB.js |
791 | index 113fb18..f8e298b 100644 |
792 | --- a/methods/updateDB.js |
793 | +++ b/methods/updateDB.js |
794 | @@ -10,6 +10,7 @@ const getClients = async () => { |
795 | let TS = []; |
796 | |
797 | await fs.readdir(path.join(__dirname, '../clients'), (err, files) => { |
798 | + console.log(files); |
799 | if (err) { console.log(err); } |
800 | for (let i = 0; i < files.length; i++) { |
801 | TS.push(files[i].toString().toUpperCase()); |
802 | @@ -26,7 +27,7 @@ const singleClient = async (clientName) => { |
803 | |
804 | console.log(clientName); |
805 | |
806 | - const CLIENTS = Array.from(await getClients()); |
807 | + const CLIENTS = getClients(); |
808 | const client = await Client.findOne({ name: clientName.toUpperCase() }); |
809 | |
810 | if (!client) { |
811 | @@ -34,6 +35,8 @@ const singleClient = async (clientName) => { |
812 | return; |
813 | } else { |
814 | |
815 | + console.log(client); |
816 | + |
817 | const clientInputs = await fs.readdir(path.join(__dirname, `../clients/${clientName.toLowerCase()}/inputs`), async (err, inputs) => { |
818 | const clientTemplates = await fs.readdir(path.join(__dirname, `../clients/${clientName.toLowerCase()}/templates`), (err, files) => { |
819 | |
820 | @@ -66,12 +69,11 @@ const singleClient = async (clientName) => { |
821 | } else { |
822 | |
823 | if (template.emails.filter(email => email.name === templateName).length === 0) { |
824 | - await Template.findOneAndUpdate({ client: client._id }, { $push: { emails: { name: templateName, html: templateContent, requires: JSON.parse(fs.readFileSync(templateInputs, 'utf8')) } } }).then(() => { |
825 | + template.emails.push({ name: templateName, html: templateContent, requires: JSON.parse(fs.readFileSync(templateInputs, 'utf8')) }); |
826 | + await template.save().then(() => { |
827 | console.log(`[+] `.green + `${templateName.yellow} template added to ${clientName.green} client`); |
828 | }); |
829 | - |
830 | } else { |
831 | - |
832 | console.log(`[-] `.red + `${templateName.cyan} template already exists under ${clientName.cyan} client`); |
833 | |
834 | } |
835 | @@ -103,7 +105,8 @@ const updateTemplates = async () => { |
836 | |
837 | const updateClients = async () => { |
838 | |
839 | - const clients = JSON.parse(fs.readFileSync(path.join(__dirname, '../clients/clients.json'), 'utf-8')); |
840 | + const clients = JSON.parse(fs.readFileSync(path.join(__dirname, '../config/clients.json'), 'utf-8')); |
841 | + console.log(clients); |
842 | |
843 | try { |
844 | await Client.deleteMany(); |
845 | diff --git a/models/template.js b/models/template.js |
846 | index ee517bf..f320b0b 100644 |
847 | --- a/models/template.js |
848 | +++ b/models/template.js |
849 | @@ -2,7 +2,7 @@ |
850 | const mongoose = require('mongoose'); |
851 | |
852 | const TemplateSchema = new mongoose.Schema({ |
853 | - client: { type: mongoose.Schema.Types.ObjectId, ref: 'Client' }, |
854 | + client: { type: String }, |
855 | clientName: { type: String }, |
856 | emails: [Object], |
857 | }); |
858 | diff --git a/routes/api.js b/routes/api.js |
859 | index 471e699..0028510 100644 |
860 | --- a/routes/api.js |
861 | +++ b/routes/api.js |
862 | @@ -1,7 +1,9 @@ |
863 | +const { getClient, getTemplate, mail, test } = require('../methods/main'); |
864 | + |
865 | +const { updateClients, updateTemplates, singleClient } = require('../methods/updateDB'); |
866 | |
867 | -const router = require('express').Router(); |
868 | -const { getClient, getTemplate, mail, test, updateClients, updateTemplates, singleClient } = require('../methods/main'); |
869 | |
870 | +const router = require('express').Router(); |
871 | |
872 | // getClient (name, token) |
873 | // getTemplate (name, token, type) |
874 | @@ -25,22 +27,28 @@ router.post('/sendmail', async (req, res) => { |
875 | |
876 | router.post('/test', async (req, res) => { |
877 | |
878 | + |
879 | const { recipient, link, name, token, type } = req.body; |
880 | |
881 | if (!recipient || !link || !name || !token || !type) { |
882 | console.log(`Unauthorized test attempt from ${req.headers['x-forwarded-for'] || req.connection.remoteAddress}`); |
883 | return res.status(400).json({ error: 'Missing parameters' }); |
884 | } else { |
885 | - await test(recipient, link, name, token, type).then(() => { |
886 | - res.status(200).json({ status: 'success', message: 'Mail sent' }); |
887 | - }).catch((err) => { |
888 | - res.status(500).json({ status: 'error', message: err }); |
889 | + |
890 | + await getClient(name, token).then(async (client) => { |
891 | + if (client) { |
892 | + await test(recipient, link, name, token, type); |
893 | + res.status(200).json({ status: 'success', message: 'Test mail sent' }); |
894 | + } else { |
895 | + res.status(401).json({ error: 'Unauthorized' }); |
896 | + } |
897 | }); |
898 | |
899 | } |
900 | |
901 | }); |
902 | |
903 | + |
904 | router.post('/updateC', async (req, res) => { |
905 | |
906 | const { token } = req.body; |