tafil-node-api 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of tafil-node-api might be problematic. Click here for more details.
- package/.env +3 -0
- package/app.js +28 -0
- package/bin/generate-app.js +71 -0
- package/controllers/AuthControllers.js +113 -0
- package/controllers/UserControllers.js +34 -0
- package/helpers/SendEmail.js +28 -0
- package/middlewares/authMiddlware.js +28 -0
- package/middlewares/error.js +17 -0
- package/models/userModel.js +36 -0
- package/package.json +26 -0
- package/routes/AuthRoutes.js +16 -0
- package/routes/UserRoutes.js +10 -0
- package/routes/routes.js +9 -0
- package/services/AuthService.js +237 -0
- package/services/UserService.js +116 -0
- package/utils/generateToken.js +11 -0
- package/views/reset-failed.ejs +340 -0
- package/views/reset-password.ejs +482 -0
- package/views/unverified-email.ejs +342 -0
- package/views/verified-email.ejs +362 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta http-equiv="x-ua-compatible" content="ie=edge" />
|
|
6
|
+
<title>Password Reset</title>
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
|
9
|
+
<style type="text/css">
|
|
10
|
+
/**
|
|
11
|
+
* Google webfonts. Recommended to include the .woff version for cross-client compatibility.
|
|
12
|
+
*/
|
|
13
|
+
@media screen {
|
|
14
|
+
@font-face {
|
|
15
|
+
font-family: "Source Sans Pro";
|
|
16
|
+
font-style: normal;
|
|
17
|
+
font-weight: 400;
|
|
18
|
+
src: local("Source Sans Pro Regular"), local("SourceSansPro-Regular"),
|
|
19
|
+
url(https://fonts.gstatic.com/s/sourcesanspro/v10/ODelI1aHBYDBqgeIAH2zlBM0YzuT7MdOe03otPbuUS0.woff)
|
|
20
|
+
format("woff");
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@font-face {
|
|
24
|
+
font-family: "Source Sans Pro";
|
|
25
|
+
font-style: normal;
|
|
26
|
+
font-weight: 700;
|
|
27
|
+
src: local("Source Sans Pro Bold"), local("SourceSansPro-Bold"),
|
|
28
|
+
url(https://fonts.gstatic.com/s/sourcesanspro/v10/toadOcfmlt9b38dHJxOBGFkQc6VGVFSmCnC_l7QZG60.woff)
|
|
29
|
+
format("woff");
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Avoid browser level font resizing.
|
|
35
|
+
* 1. Windows Mobile
|
|
36
|
+
* 2. iOS / OSX
|
|
37
|
+
*/
|
|
38
|
+
body,
|
|
39
|
+
table,
|
|
40
|
+
td,
|
|
41
|
+
a {
|
|
42
|
+
-ms-text-size-adjust: 100%; /* 1 */
|
|
43
|
+
-webkit-text-size-adjust: 100%; /* 2 */
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Remove extra space added to tables and cells in Outlook.
|
|
48
|
+
*/
|
|
49
|
+
table,
|
|
50
|
+
td {
|
|
51
|
+
mso-table-rspace: 0pt;
|
|
52
|
+
mso-table-lspace: 0pt;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Better fluid images in Internet Explorer.
|
|
57
|
+
*/
|
|
58
|
+
img {
|
|
59
|
+
-ms-interpolation-mode: bicubic;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Remove blue links for iOS devices.
|
|
64
|
+
*/
|
|
65
|
+
a[x-apple-data-detectors] {
|
|
66
|
+
font-family: inherit !important;
|
|
67
|
+
font-size: inherit !important;
|
|
68
|
+
font-weight: inherit !important;
|
|
69
|
+
line-height: inherit !important;
|
|
70
|
+
color: inherit !important;
|
|
71
|
+
text-decoration: none !important;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Fix centering issues in Android 4.4.
|
|
76
|
+
*/
|
|
77
|
+
div[style*="margin: 16px 0;"] {
|
|
78
|
+
margin: 0 !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
body {
|
|
82
|
+
width: 100% !important;
|
|
83
|
+
height: 100% !important;
|
|
84
|
+
padding: 0 !important;
|
|
85
|
+
margin: 0 !important;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Collapse table borders to avoid space between cells.
|
|
90
|
+
*/
|
|
91
|
+
table {
|
|
92
|
+
border-collapse: collapse !important;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
a {
|
|
96
|
+
color: #1a82e2;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
img {
|
|
100
|
+
height: auto;
|
|
101
|
+
line-height: 100%;
|
|
102
|
+
text-decoration: none;
|
|
103
|
+
border: 0;
|
|
104
|
+
outline: none;
|
|
105
|
+
}
|
|
106
|
+
.form {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
}
|
|
110
|
+
.form > input {
|
|
111
|
+
margin: 3px 6px 6px 0;
|
|
112
|
+
padding: 6px;
|
|
113
|
+
width: 35%;
|
|
114
|
+
}
|
|
115
|
+
#password {
|
|
116
|
+
border: 1px solid grey;
|
|
117
|
+
border-radius: 3px;
|
|
118
|
+
font-weight: bold;
|
|
119
|
+
}
|
|
120
|
+
.submit {
|
|
121
|
+
cursor: pointer;
|
|
122
|
+
text-align: center;
|
|
123
|
+
border: none;
|
|
124
|
+
border-radius: 6px;
|
|
125
|
+
color: whitesmoke;
|
|
126
|
+
background-color: royalblue;
|
|
127
|
+
font-weight: bold;
|
|
128
|
+
}
|
|
129
|
+
.submit:hover {
|
|
130
|
+
background-color: rgba(65, 105, 225, 0.782);
|
|
131
|
+
}
|
|
132
|
+
.submited {
|
|
133
|
+
background-color: grey;
|
|
134
|
+
cursor: default;
|
|
135
|
+
}
|
|
136
|
+
.submited:hover {
|
|
137
|
+
background-color: grey;
|
|
138
|
+
}
|
|
139
|
+
.none {
|
|
140
|
+
display: none;
|
|
141
|
+
}
|
|
142
|
+
.success {
|
|
143
|
+
color: green;
|
|
144
|
+
}
|
|
145
|
+
.error {
|
|
146
|
+
color: red;
|
|
147
|
+
}
|
|
148
|
+
.red {
|
|
149
|
+
color: red !important;
|
|
150
|
+
}
|
|
151
|
+
</style>
|
|
152
|
+
</head>
|
|
153
|
+
<body style="background-color: #e9ecef">
|
|
154
|
+
<!-- start preheader -->
|
|
155
|
+
<div
|
|
156
|
+
class="preheader"
|
|
157
|
+
style="
|
|
158
|
+
display: none;
|
|
159
|
+
max-width: 0;
|
|
160
|
+
max-height: 0;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
font-size: 1px;
|
|
163
|
+
line-height: 1px;
|
|
164
|
+
color: #fff;
|
|
165
|
+
opacity: 0;
|
|
166
|
+
"
|
|
167
|
+
>
|
|
168
|
+
A preheader is the short summary text that follows the subject line when
|
|
169
|
+
an email is viewed in the inbox.
|
|
170
|
+
</div>
|
|
171
|
+
<!-- end preheader -->
|
|
172
|
+
|
|
173
|
+
<!-- start body -->
|
|
174
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
175
|
+
<!-- start logo -->
|
|
176
|
+
<tr>
|
|
177
|
+
<td align="center" bgcolor="#e9ecef">
|
|
178
|
+
<!--[if (gte mso 9)|(IE)]>
|
|
179
|
+
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
|
|
180
|
+
<tr>
|
|
181
|
+
<td align="center" valign="top" width="600">
|
|
182
|
+
<![endif]-->
|
|
183
|
+
<table border="0" cellpadding="0" cellspacing="0" width="100%" style="max-width: 600px;">
|
|
184
|
+
<tr>
|
|
185
|
+
<td align="center" valign="top" style="padding: 36px 24px;">
|
|
186
|
+
<a href="#" style="display: inline-block;">
|
|
187
|
+
<img src="/images/pawwhite.png" alt="Logo" border="0" width="48" style="display: block; width: 48px; max-width: 48px; min-width: 48px;">
|
|
188
|
+
</a>
|
|
189
|
+
</td>
|
|
190
|
+
</tr>
|
|
191
|
+
</table>
|
|
192
|
+
<!--[if (gte mso 9)|(IE)]>
|
|
193
|
+
</td>
|
|
194
|
+
</tr>
|
|
195
|
+
</table>
|
|
196
|
+
<![endif]-->
|
|
197
|
+
</td>
|
|
198
|
+
</tr>
|
|
199
|
+
<!-- end logo -->
|
|
200
|
+
<!-- start hero -->
|
|
201
|
+
<tr>
|
|
202
|
+
<td align="center" bgcolor="#e9ecef">
|
|
203
|
+
<!--[if (gte mso 9)|(IE)]>
|
|
204
|
+
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
|
|
205
|
+
<tr>
|
|
206
|
+
<td align="center" valign="top" width="600">
|
|
207
|
+
<![endif]-->
|
|
208
|
+
<table
|
|
209
|
+
border="0"
|
|
210
|
+
cellpadding="0"
|
|
211
|
+
cellspacing="0"
|
|
212
|
+
width="100%"
|
|
213
|
+
style="max-width: 600px"
|
|
214
|
+
>
|
|
215
|
+
<tr>
|
|
216
|
+
<td
|
|
217
|
+
align="left"
|
|
218
|
+
bgcolor="#ffffff"
|
|
219
|
+
style="
|
|
220
|
+
padding: 36px 24px 0;
|
|
221
|
+
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
|
|
222
|
+
border-top: 3px solid #d4dadf;
|
|
223
|
+
"
|
|
224
|
+
>
|
|
225
|
+
<h1
|
|
226
|
+
style="
|
|
227
|
+
margin: 0;
|
|
228
|
+
font-size: 32px;
|
|
229
|
+
font-weight: 700;
|
|
230
|
+
letter-spacing: -1px;
|
|
231
|
+
line-height: 48px;
|
|
232
|
+
"
|
|
233
|
+
>
|
|
234
|
+
Reset Your Password
|
|
235
|
+
</h1>
|
|
236
|
+
</td>
|
|
237
|
+
</tr>
|
|
238
|
+
</table>
|
|
239
|
+
<!--[if (gte mso 9)|(IE)]>
|
|
240
|
+
</td>
|
|
241
|
+
</tr>
|
|
242
|
+
</table>
|
|
243
|
+
<![endif]-->
|
|
244
|
+
</td>
|
|
245
|
+
</tr>
|
|
246
|
+
<!-- end hero -->
|
|
247
|
+
|
|
248
|
+
<!-- start copy block -->
|
|
249
|
+
<tr>
|
|
250
|
+
<td align="center" bgcolor="#e9ecef">
|
|
251
|
+
<!--[if (gte mso 9)|(IE)]>
|
|
252
|
+
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
|
|
253
|
+
<tr>
|
|
254
|
+
<td align="center" valign="top" width="600">
|
|
255
|
+
<![endif]-->
|
|
256
|
+
<table
|
|
257
|
+
border="0"
|
|
258
|
+
cellpadding="0"
|
|
259
|
+
cellspacing="0"
|
|
260
|
+
width="100%"
|
|
261
|
+
style="max-width: 600px"
|
|
262
|
+
>
|
|
263
|
+
<!-- start copy -->
|
|
264
|
+
<tr>
|
|
265
|
+
<td
|
|
266
|
+
align="left"
|
|
267
|
+
bgcolor="#ffffff"
|
|
268
|
+
style="
|
|
269
|
+
padding: 24px;
|
|
270
|
+
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
|
|
271
|
+
font-size: 16px;
|
|
272
|
+
line-height: 24px;
|
|
273
|
+
"
|
|
274
|
+
>
|
|
275
|
+
<p style="margin: 0">
|
|
276
|
+
Type your new password in the input field below, and click on
|
|
277
|
+
submit. If you didn't request a new password, you can safely
|
|
278
|
+
delete this email.
|
|
279
|
+
</p>
|
|
280
|
+
</td>
|
|
281
|
+
</tr>
|
|
282
|
+
<!-- end copy -->
|
|
283
|
+
<tr>
|
|
284
|
+
<td
|
|
285
|
+
align="left"
|
|
286
|
+
bgcolor="#ffffff"
|
|
287
|
+
style="
|
|
288
|
+
padding: 24px 24px 3px 24px;
|
|
289
|
+
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
|
|
290
|
+
font-size: 16px;
|
|
291
|
+
line-height: 24px;
|
|
292
|
+
"
|
|
293
|
+
>
|
|
294
|
+
<p style="margin: 0">New Password:</p>
|
|
295
|
+
<p
|
|
296
|
+
style="
|
|
297
|
+
margin: 0;
|
|
298
|
+
padding: 2px 0 0 0;
|
|
299
|
+
color: grey;
|
|
300
|
+
font-weight: light;
|
|
301
|
+
font-size: 0.85em;
|
|
302
|
+
"
|
|
303
|
+
class="validation"
|
|
304
|
+
>
|
|
305
|
+
Notice! Your password must contain more than 10 characters
|
|
306
|
+
</p>
|
|
307
|
+
</td>
|
|
308
|
+
</tr>
|
|
309
|
+
<!-- start button -->
|
|
310
|
+
<tr>
|
|
311
|
+
<td
|
|
312
|
+
align="left"
|
|
313
|
+
bgcolor="#ffffff"
|
|
314
|
+
style="
|
|
315
|
+
padding: 3px 24px 24px 24px;
|
|
316
|
+
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
|
|
317
|
+
font-size: 16px;
|
|
318
|
+
line-height: 24px;
|
|
319
|
+
"
|
|
320
|
+
>
|
|
321
|
+
<form class="form" method="post">
|
|
322
|
+
<input
|
|
323
|
+
type="password"
|
|
324
|
+
name="password"
|
|
325
|
+
id="password"
|
|
326
|
+
placeholder="password"
|
|
327
|
+
onchange="updatePassword(event)"
|
|
328
|
+
/>
|
|
329
|
+
<input
|
|
330
|
+
class="submit"
|
|
331
|
+
onclick="submitFunc(event)"
|
|
332
|
+
value="Submit"
|
|
333
|
+
/>
|
|
334
|
+
</form>
|
|
335
|
+
</td>
|
|
336
|
+
</tr>
|
|
337
|
+
<!-- end button -->
|
|
338
|
+
<tr class="none" id="msrow">
|
|
339
|
+
<td
|
|
340
|
+
align="left"
|
|
341
|
+
bgcolor="#ffffff"
|
|
342
|
+
style="
|
|
343
|
+
padding: 24px;
|
|
344
|
+
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
|
|
345
|
+
font-size: 16px;
|
|
346
|
+
line-height: 24px;
|
|
347
|
+
border-bottom: 3px solid #d4dadf;
|
|
348
|
+
"
|
|
349
|
+
>
|
|
350
|
+
<p style="margin: 0" class="success none">
|
|
351
|
+
Cheers,<br />
|
|
352
|
+
Your Password Updated
|
|
353
|
+
</p>
|
|
354
|
+
<p style="margin: 0" class="error none">
|
|
355
|
+
Failed,<br />
|
|
356
|
+
If you are getting this error your link is invalid, expired,
|
|
357
|
+
or user doesn't exist (after 15 minutes this link expires)
|
|
358
|
+
</p>
|
|
359
|
+
</td>
|
|
360
|
+
</tr>
|
|
361
|
+
</table>
|
|
362
|
+
<!--[if (gte mso 9)|(IE)]>
|
|
363
|
+
</td>
|
|
364
|
+
</tr>
|
|
365
|
+
</table>
|
|
366
|
+
<![endif]-->
|
|
367
|
+
</td>
|
|
368
|
+
</tr>
|
|
369
|
+
<!-- end copy block -->
|
|
370
|
+
|
|
371
|
+
<!-- start footer -->
|
|
372
|
+
<tr>
|
|
373
|
+
<td align="center" bgcolor="#e9ecef" style="padding: 24px">
|
|
374
|
+
<!--[if (gte mso 9)|(IE)]>
|
|
375
|
+
<table align="center" border="0" cellpadding="0" cellspacing="0" width="600">
|
|
376
|
+
<tr>
|
|
377
|
+
<td align="center" valign="top" width="600">
|
|
378
|
+
<![endif]-->
|
|
379
|
+
<table
|
|
380
|
+
border="0"
|
|
381
|
+
cellpadding="0"
|
|
382
|
+
cellspacing="0"
|
|
383
|
+
width="100%"
|
|
384
|
+
style="max-width: 600px"
|
|
385
|
+
>
|
|
386
|
+
<!-- start permission -->
|
|
387
|
+
<tr>
|
|
388
|
+
<td
|
|
389
|
+
align="center"
|
|
390
|
+
bgcolor="#e9ecef"
|
|
391
|
+
style="
|
|
392
|
+
padding: 12px 24px;
|
|
393
|
+
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
|
|
394
|
+
font-size: 14px;
|
|
395
|
+
line-height: 20px;
|
|
396
|
+
color: #666;
|
|
397
|
+
"
|
|
398
|
+
>
|
|
399
|
+
<p style="margin: 0">
|
|
400
|
+
You received this email because we received a request for
|
|
401
|
+
reseting a password for your account. If you didn't request
|
|
402
|
+
reseting your password you can safely delete this email.
|
|
403
|
+
</p>
|
|
404
|
+
</td>
|
|
405
|
+
</tr>
|
|
406
|
+
<!-- end permission -->
|
|
407
|
+
|
|
408
|
+
<!-- start unsubscribe -->
|
|
409
|
+
<tr>
|
|
410
|
+
<td
|
|
411
|
+
align="center"
|
|
412
|
+
bgcolor="#e9ecef"
|
|
413
|
+
style="
|
|
414
|
+
padding: 12px 24px;
|
|
415
|
+
font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
|
|
416
|
+
font-size: 14px;
|
|
417
|
+
line-height: 20px;
|
|
418
|
+
color: #666;
|
|
419
|
+
"
|
|
420
|
+
>
|
|
421
|
+
<p style="margin: 0">Paws, 2021</p>
|
|
422
|
+
</td>
|
|
423
|
+
</tr>
|
|
424
|
+
<!-- end unsubscribe -->
|
|
425
|
+
</table>
|
|
426
|
+
<!--[if (gte mso 9)|(IE)]>
|
|
427
|
+
</td>
|
|
428
|
+
</tr>
|
|
429
|
+
</table>
|
|
430
|
+
<![endif]-->
|
|
431
|
+
</td>
|
|
432
|
+
</tr>
|
|
433
|
+
<!-- end footer -->
|
|
434
|
+
</table>
|
|
435
|
+
<!-- end body -->
|
|
436
|
+
<script>
|
|
437
|
+
let passwordInput = document.querySelector("#password");
|
|
438
|
+
let password = document.querySelector("#password").value;
|
|
439
|
+
let submit = document.querySelector(".submit");
|
|
440
|
+
let msrow = document.querySelector("#msrow");
|
|
441
|
+
let success = document.querySelector(".success");
|
|
442
|
+
let expire = document.querySelector(".error");
|
|
443
|
+
let validation = document.querySelector(".validation");
|
|
444
|
+
|
|
445
|
+
function updatePassword(e) {
|
|
446
|
+
password = e.target.value;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const url = window.location.href;
|
|
450
|
+
|
|
451
|
+
async function submitFunc(e) {
|
|
452
|
+
if (password.length <= 10) {
|
|
453
|
+
validation.classList.add("red");
|
|
454
|
+
} else {
|
|
455
|
+
e.preventDefault();
|
|
456
|
+
validation.classList.remove("red");
|
|
457
|
+
submit.disabled = true;
|
|
458
|
+
submit.value = `Loading...`;
|
|
459
|
+
passwordInput.disabled = true;
|
|
460
|
+
await axios
|
|
461
|
+
.post(`${url}`, {
|
|
462
|
+
password: password,
|
|
463
|
+
})
|
|
464
|
+
.then((result) => {
|
|
465
|
+
console.log(result);
|
|
466
|
+
submit.value = `Success`;
|
|
467
|
+
submit.classList.add("submited");
|
|
468
|
+
msrow.classList.remove("none");
|
|
469
|
+
success.classList.remove("none");
|
|
470
|
+
})
|
|
471
|
+
.catch((error) => {
|
|
472
|
+
console.log(error.message);
|
|
473
|
+
submit.value = `Failed`;
|
|
474
|
+
submit.classList.add("submited");
|
|
475
|
+
msrow.classList.remove("none");
|
|
476
|
+
expire.classList.remove("none");
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
</script>
|
|
481
|
+
</body>
|
|
482
|
+
</html>
|