Bläddra i källkod

Merge branch 'brian_dev_brevo' of fyindr/siimee into dev

tags/0.0.4
maeda 2 år sedan
förälder
incheckning
2b78f2a87e
5 ändrade filer med 239 tillägg och 95 borttagningar
  1. 43
    14
      backend/README.md
  2. 19
    14
      backend/lib/services/user.js
  3. 175
    58
      backend/package-lock.json
  4. 2
    2
      backend/package.json
  5. 0
    7
      frontend/src/views/VerifyView.vue

+ 43
- 14
backend/README.md Visa fil

7
 You will need...
7
 You will need...
8
 
8
 
9
 ### Node.js 14+
9
 ### Node.js 14+
10
-* OSX: `brew install node` using [Homebrew](http://brew.sh/)
11
-* Linux: `apt install nodejs` ([see Ubuntu/Debian specific instructions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)) or `pacman -S nodejs` (Arch Linux)
12
-* Windows: [Install](https://nodejs.org/en/download/)
10
+
11
+-   OSX: `brew install node` using [Homebrew](http://brew.sh/)
12
+-   Linux: `apt install nodejs` ([see Ubuntu/Debian specific instructions](https://nodejs.org/en/download/package-manager/#debian-and-ubuntu-based-linux-distributions)) or `pacman -S nodejs` (Arch Linux)
13
+-   Windows: [Install](https://nodejs.org/en/download/)
13
 
14
 
14
 ## :package: Installation
15
 ## :package: Installation
15
 
16
 
19
 4. A test database container is provided and can be started with `docker-compose up -d`
20
 4. A test database container is provided and can be started with `docker-compose up -d`
20
 5. Populate some basic tables for your database using `npm run generate && npm run reseed`
21
 5. Populate some basic tables for your database using `npm run generate && npm run reseed`
21
 
22
 
23
+## :package: Installing Brevo
24
+
25
+This note is added in case Brevo fails to install correctly, as it requires some extra configuration:
26
+
27
+1. Should brevo fail to work upon spinning up, ensure that brevo is installed:
28
+
29
+```
30
+npm install @getbrevo/brevo --save
31
+```
32
+
33
+2. Then run 'npm install' again.
34
+3. Link the brevo package globally by running 'npm link'.
35
+4. You'll also need to link it directly within the backend directory (here):
36
+
37
+```
38
+npm link .
39
+```
40
+
41
+Transactional emails using the Brevo api should now be working.
42
+
22
 ## :package: Migrations
43
 ## :package: Migrations
23
 
44
 
24
 We use Knex.js,which comes with a couple nice database migration and seeding tools.
45
 We use Knex.js,which comes with a couple nice database migration and seeding tools.
25
 Migrating tracks changes in schema. Migration steps are contained in the `./db/migrations` folder. Seeding adds dummy data once our database tables have been created and schemas are set. Starting seed steps are contained in `./db/seeds` and use the `mock.js` file as the main dummy data source.
46
 Migrating tracks changes in schema. Migration steps are contained in the `./db/migrations` folder. Seeding adds dummy data once our database tables have been created and schemas are set. Starting seed steps are contained in `./db/seeds` and use the `mock.js` file as the main dummy data source.
26
 
47
 
27
 ### Migrating
48
 ### Migrating
28
-* Run `npm run migrate` to run all migrations and establish the base schema
29
-* Run `npm run unmigrate` to roll back one migration
49
+
50
+-   Run `npm run migrate` to run all migrations and establish the base schema
51
+-   Run `npm run unmigrate` to roll back one migration
30
 
52
 
31
 ### Seeding
53
 ### Seeding
32
-* Run `npm run generate` to generate dummy data
33
-* Run `npm run seed` to seed the database with generated dummy data
54
+
55
+-   Run `npm run generate` to generate dummy data
56
+-   Run `npm run seed` to seed the database with generated dummy data
34
 
57
 
35
 ### Restarting
58
 ### Restarting
59
+
36
 Since we can't unseed the database, it's best to destroy the `dev` database and rebuild it.
60
 Since we can't unseed the database, it's best to destroy the `dev` database and rebuild it.
37
 
61
 
38
 1. Stop the database by navigating to the project root directory `cd ../` and running `docker-compose down`
62
 1. Stop the database by navigating to the project root directory `cd ../` and running `docker-compose down`
52
 ## :pill: Tests & Code Quality
76
 ## :pill: Tests & Code Quality
53
 
77
 
54
 Tests are run with AVA with code coverage reporting via nyc. Look at the example test for ideas, as well as the [ava documentation](https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md)
78
 Tests are run with AVA with code coverage reporting via nyc. Look at the example test for ideas, as well as the [ava documentation](https://github.com/avajs/ava/blob/main/docs/01-writing-tests.md)
55
-* Run tests with coverage report with `npm test`
79
+
80
+-   Run tests with coverage report with `npm test`
56
 
81
 
57
 ## :heart: Built With
82
 ## :heart: Built With
58
 
83
 
59
-* [Hapi](https://hapy.dev/) - Happy APIs
60
-* [Objection](https://vincit.github.io/objection.js/) - Light ORM
61
-* [Knex.js](https://knexjs.org/) - Query builder
62
-* [Schiwfty](https://hapipal.com/docs/schwifty) - Model layer
63
-* [Ava](https://github.com/avajs/ava) - Easy testing
64
-* [Nyc](https://github.com/istanbuljs/nyc) - Test coverage with Istanbul's CLI
84
+-   [Hapi](https://hapy.dev/) - Happy APIs
85
+-   [Objection](https://vincit.github.io/objection.js/) - Light ORM
86
+-   [Knex.js](https://knexjs.org/) - Query builder
87
+-   [Schiwfty](https://hapipal.com/docs/schwifty) - Model layer
88
+-   [Ava](https://github.com/avajs/ava) - Easy testing
89
+-   [Nyc](https://github.com/istanbuljs/nyc) - Test coverage with Istanbul's CLI
90
+
91
+```
92
+
93
+```

+ 19
- 14
backend/lib/services/user.js Visa fil

7
 const SecurePassword = require('secure-password')
7
 const SecurePassword = require('secure-password')
8
 
8
 
9
 // Configuration for Brevo
9
 // Configuration for Brevo
10
-const SibApiV3Sdk = require('sib-api-v3-sdk')
11
-const defaultClient = SibApiV3Sdk.ApiClient.instance
10
+const Brevo = require('@getbrevo/brevo')
11
+const defaultClient = Brevo.ApiClient.instance
12
 const apiKey = defaultClient.authentications['api-key']
12
 const apiKey = defaultClient.authentications['api-key']
13
 apiKey.apiKey = process.env.BREVO_KEY
13
 apiKey.apiKey = process.env.BREVO_KEY
14
-const apiInstance = new SibApiV3Sdk.TransactionalEmailsApi()
14
+const apiInstance = new Brevo.TransactionalEmailsApi()
15
+const sendSmtpEmail = new Brevo.SendSmtpEmail()
15
 
16
 
16
 // TODO: Consider implementing, nice use of SecurePassword,
17
 // TODO: Consider implementing, nice use of SecurePassword,
17
 // but currently not used anywhere...
18
 // but currently not used anywhere...
333
             emailWasRespondedTo: false,
334
             emailWasRespondedTo: false,
334
             accessToken: null,
335
             accessToken: null,
335
         }
336
         }
336
-        const sendSmtpEmail = {
337
-            to: [
338
-                {
339
-                    email: userCredentials.email,
340
-                },
341
-            ],
342
-            templateId: Number(process.env.BREVO_TEMPLATE_ID),
343
-            params: {
344
-                // TODO: Change this in production...
345
-                link: `${process.env.BREVO_LINK}/verify/${hashedSessionToken}`,
337
+        // NOTE: Although this looks messy, Brevo requries these
338
+        // parameters be defined individually like this, attempts
339
+        // to configure this in a singel object cause errors on their API
340
+        sendSmtpEmail.sender = {
341
+            name: 'My Test Company',
342
+            email: 'mytestemail@email.com',
343
+        }
344
+        sendSmtpEmail.subject = 'My Test Company'
345
+        sendSmtpEmail.to = [
346
+            {
347
+                email: userCredentials.email,
346
             },
348
             },
349
+        ]
350
+        sendSmtpEmail.templateId = Number(process.env.BREVO_TEMPLATE_ID)
351
+        sendSmtpEmail.params = {
352
+            link: `${process.env.BREVO_LINK}/verify/${hashedSessionToken}`,
347
         }
353
         }
348
-
349
         return await apiInstance.sendTransacEmail(sendSmtpEmail).then(
354
         return await apiInstance.sendTransacEmail(sendSmtpEmail).then(
350
             data => {
355
             data => {
351
                 return { wasSuccessfull: true, data: data }
356
                 return { wasSuccessfull: true, data: data }

+ 175
- 58
backend/package-lock.json Visa fil

9
             "version": "1.0.0",
9
             "version": "1.0.0",
10
             "license": "UNLICENSED",
10
             "license": "UNLICENSED",
11
             "dependencies": {
11
             "dependencies": {
12
+                "@getbrevo/brevo": "^1.0.1",
12
                 "@hapi/glue": "^8.0.0",
13
                 "@hapi/glue": "^8.0.0",
13
                 "@hapi/hapi": "^20.1.3",
14
                 "@hapi/hapi": "^20.1.3",
14
                 "@hapi/inert": "^6.0.3",
15
                 "@hapi/inert": "^6.0.3",
28
                 "knex": "^0.21.19",
29
                 "knex": "^0.21.19",
29
                 "mysql": "^2.18.1",
30
                 "mysql": "^2.18.1",
30
                 "objection": "^2.2.18",
31
                 "objection": "^2.2.18",
31
-                "secure-password": "^4.0.0",
32
-                "sib-api-v3-sdk": "^8.5.0"
32
+                "secure-password": "^4.0.0"
33
             },
33
             },
34
             "devDependencies": {
34
             "devDependencies": {
35
                 "ava": "^3.15.0",
35
                 "ava": "^3.15.0",
577
                 "url": "https://github.com/sponsors/sindresorhus"
577
                 "url": "https://github.com/sponsors/sindresorhus"
578
             }
578
             }
579
         },
579
         },
580
+        "node_modules/@getbrevo/brevo": {
581
+            "version": "1.0.1",
582
+            "resolved": "https://registry.npmjs.org/@getbrevo/brevo/-/brevo-1.0.1.tgz",
583
+            "integrity": "sha512-NwUOlkft6NwLSKTph9FWQujMM5ysSGWOa9Wdf0Bc/RezejOW5VG5KXvTmXrF1Q+MHmjzTh6GDWjq5EukQsDdnA==",
584
+            "dependencies": {
585
+                "querystring": "^0.2.1",
586
+                "superagent": "^8.0.9"
587
+            }
588
+        },
580
         "node_modules/@hapi/accept": {
589
         "node_modules/@hapi/accept": {
581
             "version": "5.0.2",
590
             "version": "5.0.2",
582
             "resolved": "https://registry.npmjs.org/@hapi/accept/-/accept-5.0.2.tgz",
591
             "resolved": "https://registry.npmjs.org/@hapi/accept/-/accept-5.0.2.tgz",
1409
                 "node": ">=8"
1418
                 "node": ">=8"
1410
             }
1419
             }
1411
         },
1420
         },
1421
+        "node_modules/asap": {
1422
+            "version": "2.0.6",
1423
+            "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
1424
+            "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA=="
1425
+        },
1412
         "node_modules/assign-symbols": {
1426
         "node_modules/assign-symbols": {
1413
             "version": "1.0.0",
1427
             "version": "1.0.0",
1414
             "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
1428
             "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
1876
             }
1890
             }
1877
         },
1891
         },
1878
         "node_modules/call-bind": {
1892
         "node_modules/call-bind": {
1879
-            "version": "1.0.2",
1880
-            "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz",
1881
-            "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==",
1893
+            "version": "1.0.5",
1894
+            "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz",
1895
+            "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==",
1882
             "dependencies": {
1896
             "dependencies": {
1883
-                "function-bind": "^1.1.1",
1884
-                "get-intrinsic": "^1.0.2"
1897
+                "function-bind": "^1.1.2",
1898
+                "get-intrinsic": "^1.2.1",
1899
+                "set-function-length": "^1.1.1"
1885
             },
1900
             },
1886
             "funding": {
1901
             "funding": {
1887
                 "url": "https://github.com/sponsors/ljharb"
1902
                 "url": "https://github.com/sponsors/ljharb"
2481
             "version": "3.2.7",
2496
             "version": "3.2.7",
2482
             "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
2497
             "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
2483
             "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
2498
             "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
2499
+            "dev": true,
2484
             "dependencies": {
2500
             "dependencies": {
2485
                 "ms": "^2.1.1"
2501
                 "ms": "^2.1.1"
2486
             }
2502
             }
2565
             "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==",
2581
             "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==",
2566
             "dev": true
2582
             "dev": true
2567
         },
2583
         },
2584
+        "node_modules/define-data-property": {
2585
+            "version": "1.1.1",
2586
+            "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz",
2587
+            "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==",
2588
+            "dependencies": {
2589
+                "get-intrinsic": "^1.2.1",
2590
+                "gopd": "^1.0.1",
2591
+                "has-property-descriptors": "^1.0.0"
2592
+            },
2593
+            "engines": {
2594
+                "node": ">= 0.4"
2595
+            }
2596
+        },
2568
         "node_modules/define-property": {
2597
         "node_modules/define-property": {
2569
             "version": "2.0.2",
2598
             "version": "2.0.2",
2570
             "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
2599
             "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz",
2615
                 "node": ">=0.10.0"
2644
                 "node": ">=0.10.0"
2616
             }
2645
             }
2617
         },
2646
         },
2647
+        "node_modules/dezalgo": {
2648
+            "version": "1.0.4",
2649
+            "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz",
2650
+            "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==",
2651
+            "dependencies": {
2652
+                "asap": "^2.0.0",
2653
+                "wrappy": "1"
2654
+            }
2655
+        },
2618
         "node_modules/diff": {
2656
         "node_modules/diff": {
2619
             "version": "5.0.0",
2657
             "version": "5.0.0",
2620
             "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
2658
             "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz",
3370
             "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
3408
             "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=",
3371
             "dev": true
3409
             "dev": true
3372
         },
3410
         },
3411
+        "node_modules/fast-safe-stringify": {
3412
+            "version": "2.1.1",
3413
+            "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz",
3414
+            "integrity": "sha512-W+KJc2dmILlPplD/H4K9l9LcAHAfPtP6BY84uVLXQ6Evcz9Lcg33Y2z1IVblT6xdY54PXYVHEv+0Wpq8Io6zkA=="
3415
+        },
3373
         "node_modules/fastq": {
3416
         "node_modules/fastq": {
3374
             "version": "1.11.0",
3417
             "version": "1.11.0",
3375
             "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz",
3418
             "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.0.tgz",
3536
             }
3579
             }
3537
         },
3580
         },
3538
         "node_modules/form-data": {
3581
         "node_modules/form-data": {
3539
-            "version": "2.5.1",
3540
-            "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
3541
-            "integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
3582
+            "version": "4.0.0",
3583
+            "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
3584
+            "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
3542
             "dependencies": {
3585
             "dependencies": {
3543
                 "asynckit": "^0.4.0",
3586
                 "asynckit": "^0.4.0",
3544
-                "combined-stream": "^1.0.6",
3587
+                "combined-stream": "^1.0.8",
3545
                 "mime-types": "^2.1.12"
3588
                 "mime-types": "^2.1.12"
3546
             },
3589
             },
3547
             "engines": {
3590
             "engines": {
3548
-                "node": ">= 0.12"
3591
+                "node": ">= 6"
3549
             }
3592
             }
3550
         },
3593
         },
3551
         "node_modules/format-util": {
3594
         "node_modules/format-util": {
3554
             "integrity": "sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg=="
3597
             "integrity": "sha512-varLbTj0e0yVyRpqQhuWV+8hlePAgaoFRhNFj50BNjEIrw1/DphHSObtqwskVCPWNgzwPoQrZAbfa/SBiicNeg=="
3555
         },
3598
         },
3556
         "node_modules/formidable": {
3599
         "node_modules/formidable": {
3557
-            "version": "1.2.6",
3558
-            "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz",
3559
-            "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==",
3560
-            "deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau",
3600
+            "version": "2.1.2",
3601
+            "resolved": "https://registry.npmjs.org/formidable/-/formidable-2.1.2.tgz",
3602
+            "integrity": "sha512-CM3GuJ57US06mlpQ47YcunuUZ9jpm8Vx+P2CGt2j7HpgkKZO/DJYQ0Bobim8G6PFQmK5lOqOOdUXboU+h73A4g==",
3603
+            "dependencies": {
3604
+                "dezalgo": "^1.0.4",
3605
+                "hexoid": "^1.0.0",
3606
+                "once": "^1.4.0",
3607
+                "qs": "^6.11.0"
3608
+            },
3561
             "funding": {
3609
             "funding": {
3562
                 "url": "https://ko-fi.com/tunnckoCore/commissions"
3610
                 "url": "https://ko-fi.com/tunnckoCore/commissions"
3563
             }
3611
             }
3614
             }
3662
             }
3615
         },
3663
         },
3616
         "node_modules/function-bind": {
3664
         "node_modules/function-bind": {
3617
-            "version": "1.1.1",
3618
-            "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
3619
-            "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A=="
3665
+            "version": "1.1.2",
3666
+            "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
3667
+            "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
3668
+            "funding": {
3669
+                "url": "https://github.com/sponsors/ljharb"
3670
+            }
3620
         },
3671
         },
3621
         "node_modules/functional-red-black-tree": {
3672
         "node_modules/functional-red-black-tree": {
3622
             "version": "1.0.1",
3673
             "version": "1.0.1",
3803
                 "url": "https://github.com/sponsors/sindresorhus"
3854
                 "url": "https://github.com/sponsors/sindresorhus"
3804
             }
3855
             }
3805
         },
3856
         },
3857
+        "node_modules/gopd": {
3858
+            "version": "1.0.1",
3859
+            "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz",
3860
+            "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==",
3861
+            "dependencies": {
3862
+                "get-intrinsic": "^1.1.3"
3863
+            },
3864
+            "funding": {
3865
+                "url": "https://github.com/sponsors/ljharb"
3866
+            }
3867
+        },
3806
         "node_modules/got": {
3868
         "node_modules/got": {
3807
             "version": "9.6.0",
3869
             "version": "9.6.0",
3808
             "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
3870
             "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
3918
                 "node": ">=4"
3980
                 "node": ">=4"
3919
             }
3981
             }
3920
         },
3982
         },
3983
+        "node_modules/has-property-descriptors": {
3984
+            "version": "1.0.0",
3985
+            "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz",
3986
+            "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==",
3987
+            "dependencies": {
3988
+                "get-intrinsic": "^1.1.1"
3989
+            },
3990
+            "funding": {
3991
+                "url": "https://github.com/sponsors/ljharb"
3992
+            }
3993
+        },
3921
         "node_modules/has-proto": {
3994
         "node_modules/has-proto": {
3922
             "version": "1.0.1",
3995
             "version": "1.0.1",
3923
             "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
3996
             "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
4028
             "resolved": "https://registry.npmjs.org/haversine/-/haversine-1.1.1.tgz",
4101
             "resolved": "https://registry.npmjs.org/haversine/-/haversine-1.1.1.tgz",
4029
             "integrity": "sha512-KW4MS8+krLIeiw8bF5z532CptG0ZyGGFj0UbKMxx25lKnnJ1hMUbuzQl+PXQjNiDLnl1bOyz23U6hSK10r4guw=="
4102
             "integrity": "sha512-KW4MS8+krLIeiw8bF5z532CptG0ZyGGFj0UbKMxx25lKnnJ1hMUbuzQl+PXQjNiDLnl1bOyz23U6hSK10r4guw=="
4030
         },
4103
         },
4104
+        "node_modules/hexoid": {
4105
+            "version": "1.0.0",
4106
+            "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz",
4107
+            "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==",
4108
+            "engines": {
4109
+                "node": ">=8"
4110
+            }
4111
+        },
4031
         "node_modules/homedir-polyfill": {
4112
         "node_modules/homedir-polyfill": {
4032
             "version": "1.0.3",
4113
             "version": "1.0.3",
4033
             "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
4114
             "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz",
5337
             }
5418
             }
5338
         },
5419
         },
5339
         "node_modules/mime": {
5420
         "node_modules/mime": {
5340
-            "version": "1.6.0",
5341
-            "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
5342
-            "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
5421
+            "version": "2.6.0",
5422
+            "resolved": "https://registry.npmjs.org/mime/-/mime-2.6.0.tgz",
5423
+            "integrity": "sha512-USPkMeET31rOMiarsBNIHZKLGgvKc/LrjofAnBlOttf5ajRvqiRA8QsenbcooctK6d6Ts6aqZXBA+XbkKthiQg==",
5343
             "bin": {
5424
             "bin": {
5344
                 "mime": "cli.js"
5425
                 "mime": "cli.js"
5345
             },
5426
             },
5346
             "engines": {
5427
             "engines": {
5347
-                "node": ">=4"
5428
+                "node": ">=4.0.0"
5348
             }
5429
             }
5349
         },
5430
         },
5350
         "node_modules/mime-db": {
5431
         "node_modules/mime-db": {
5830
             }
5911
             }
5831
         },
5912
         },
5832
         "node_modules/object-inspect": {
5913
         "node_modules/object-inspect": {
5833
-            "version": "1.12.3",
5834
-            "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz",
5835
-            "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==",
5914
+            "version": "1.13.1",
5915
+            "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
5916
+            "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
5836
             "funding": {
5917
             "funding": {
5837
                 "url": "https://github.com/sponsors/ljharb"
5918
                 "url": "https://github.com/sponsors/ljharb"
5838
             }
5919
             }
5904
             "version": "1.4.0",
5985
             "version": "1.4.0",
5905
             "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
5986
             "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
5906
             "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
5987
             "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
5907
-            "dev": true,
5908
             "dependencies": {
5988
             "dependencies": {
5909
                 "wrappy": "1"
5989
                 "wrappy": "1"
5910
             }
5990
             }
6499
             }
6579
             }
6500
         },
6580
         },
6501
         "node_modules/querystring": {
6581
         "node_modules/querystring": {
6502
-            "version": "0.2.0",
6503
-            "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz",
6504
-            "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==",
6582
+            "version": "0.2.1",
6583
+            "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.1.tgz",
6584
+            "integrity": "sha512-wkvS7mL/JMugcup3/rMitHmd9ecIGd2lhFhK9N3UUQ450h66d1r3Y9nvXzQAW1Lq+wyx61k/1pfKS5KuKiyEbg==",
6505
             "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.",
6585
             "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.",
6506
             "engines": {
6586
             "engines": {
6507
                 "node": ">=0.4.x"
6587
                 "node": ">=0.4.x"
6935
             "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
7015
             "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=",
6936
             "dev": true
7016
             "dev": true
6937
         },
7017
         },
7018
+        "node_modules/set-function-length": {
7019
+            "version": "1.1.1",
7020
+            "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.1.1.tgz",
7021
+            "integrity": "sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==",
7022
+            "dependencies": {
7023
+                "define-data-property": "^1.1.1",
7024
+                "get-intrinsic": "^1.2.1",
7025
+                "gopd": "^1.0.1",
7026
+                "has-property-descriptors": "^1.0.0"
7027
+            },
7028
+            "engines": {
7029
+                "node": ">= 0.4"
7030
+            }
7031
+        },
6938
         "node_modules/set-value": {
7032
         "node_modules/set-value": {
6939
             "version": "2.0.1",
7033
             "version": "2.0.1",
6940
             "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
7034
             "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz",
6989
                 "node": ">=8"
7083
                 "node": ">=8"
6990
             }
7084
             }
6991
         },
7085
         },
6992
-        "node_modules/sib-api-v3-sdk": {
6993
-            "version": "8.5.0",
6994
-            "resolved": "https://registry.npmjs.org/sib-api-v3-sdk/-/sib-api-v3-sdk-8.5.0.tgz",
6995
-            "integrity": "sha512-6Ratp5kLN/rEEvk4XVIQ4L8IrCIrcfE9m1HjvHz/WepC+CVXPsjOlgRcK/jQjpN5kC+dmhDAqrTo1OtnF6i1wA==",
6996
-            "deprecated": "Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.",
6997
-            "dependencies": {
6998
-                "querystring": "0.2.0",
6999
-                "superagent": "3.7.0"
7000
-            }
7001
-        },
7002
         "node_modules/side-channel": {
7086
         "node_modules/side-channel": {
7003
             "version": "1.0.4",
7087
             "version": "1.0.4",
7004
             "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
7088
             "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz",
7578
             }
7662
             }
7579
         },
7663
         },
7580
         "node_modules/superagent": {
7664
         "node_modules/superagent": {
7581
-            "version": "3.7.0",
7582
-            "resolved": "https://registry.npmjs.org/superagent/-/superagent-3.7.0.tgz",
7583
-            "integrity": "sha512-/8trxO6NbLx4YXb7IeeFTSmsQ35pQBiTBsLNvobZx7qBzBeHYvKCyIIhW2gNcWbLzYxPAjdgFbiepd8ypwC0Gw==",
7584
-            "deprecated": "Please upgrade to v7.0.2+ of superagent.  We have fixed numerous issues with streams, form-data, attach(), filesystem errors not bubbling up (ENOENT on attach()), and all tests are now passing.  See the releases tab for more information at <https://github.com/visionmedia/superagent/releases>.",
7585
-            "dependencies": {
7586
-                "component-emitter": "^1.2.0",
7587
-                "cookiejar": "^2.1.0",
7588
-                "debug": "^3.1.0",
7589
-                "extend": "^3.0.0",
7590
-                "form-data": "^2.3.1",
7591
-                "formidable": "^1.1.1",
7592
-                "methods": "^1.1.1",
7593
-                "mime": "^1.4.1",
7594
-                "qs": "^6.5.1",
7595
-                "readable-stream": "^2.0.5"
7665
+            "version": "8.1.2",
7666
+            "resolved": "https://registry.npmjs.org/superagent/-/superagent-8.1.2.tgz",
7667
+            "integrity": "sha512-6WTxW1EB6yCxV5VFOIPQruWGHqc3yI7hEmZK6h+pyk69Lk/Ut7rLUY6W/ONF2MjBuGjvmMiIpsrVJ2vjrHlslA==",
7668
+            "dependencies": {
7669
+                "component-emitter": "^1.3.0",
7670
+                "cookiejar": "^2.1.4",
7671
+                "debug": "^4.3.4",
7672
+                "fast-safe-stringify": "^2.1.1",
7673
+                "form-data": "^4.0.0",
7674
+                "formidable": "^2.1.2",
7675
+                "methods": "^1.1.2",
7676
+                "mime": "2.6.0",
7677
+                "qs": "^6.11.0",
7678
+                "semver": "^7.3.8"
7596
             },
7679
             },
7597
             "engines": {
7680
             "engines": {
7598
-                "node": ">= 4.0"
7681
+                "node": ">=6.4.0 <13 || >=14"
7682
+            }
7683
+        },
7684
+        "node_modules/superagent/node_modules/debug": {
7685
+            "version": "4.3.4",
7686
+            "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
7687
+            "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
7688
+            "dependencies": {
7689
+                "ms": "2.1.2"
7690
+            },
7691
+            "engines": {
7692
+                "node": ">=6.0"
7693
+            },
7694
+            "peerDependenciesMeta": {
7695
+                "supports-color": {
7696
+                    "optional": true
7697
+                }
7698
+            }
7699
+        },
7700
+        "node_modules/superagent/node_modules/ms": {
7701
+            "version": "2.1.2",
7702
+            "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
7703
+            "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
7704
+        },
7705
+        "node_modules/superagent/node_modules/semver": {
7706
+            "version": "7.5.4",
7707
+            "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
7708
+            "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
7709
+            "dependencies": {
7710
+                "lru-cache": "^6.0.0"
7711
+            },
7712
+            "bin": {
7713
+                "semver": "bin/semver.js"
7714
+            },
7715
+            "engines": {
7716
+                "node": ">=10"
7599
             }
7717
             }
7600
         },
7718
         },
7601
         "node_modules/supertap": {
7719
         "node_modules/supertap": {
8200
         "node_modules/wrappy": {
8318
         "node_modules/wrappy": {
8201
             "version": "1.0.2",
8319
             "version": "1.0.2",
8202
             "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
8320
             "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
8203
-            "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=",
8204
-            "dev": true
8321
+            "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
8205
         },
8322
         },
8206
         "node_modules/write-file-atomic": {
8323
         "node_modules/write-file-atomic": {
8207
             "version": "3.0.3",
8324
             "version": "3.0.3",

+ 2
- 2
backend/package.json Visa fil

17
     "author": "TOJ",
17
     "author": "TOJ",
18
     "license": "UNLICENSED",
18
     "license": "UNLICENSED",
19
     "dependencies": {
19
     "dependencies": {
20
+        "@getbrevo/brevo": "^1.0.1",
20
         "@hapi/glue": "^8.0.0",
21
         "@hapi/glue": "^8.0.0",
21
         "@hapi/hapi": "^20.1.3",
22
         "@hapi/hapi": "^20.1.3",
22
         "@hapi/inert": "^6.0.3",
23
         "@hapi/inert": "^6.0.3",
36
         "knex": "^0.21.19",
37
         "knex": "^0.21.19",
37
         "mysql": "^2.18.1",
38
         "mysql": "^2.18.1",
38
         "objection": "^2.2.18",
39
         "objection": "^2.2.18",
39
-        "secure-password": "^4.0.0",
40
-        "sib-api-v3-sdk": "^8.5.0"
40
+        "secure-password": "^4.0.0"
41
     },
41
     },
42
     "devDependencies": {
42
     "devDependencies": {
43
         "ava": "^3.15.0",
43
         "ava": "^3.15.0",

+ 0
- 7
frontend/src/views/VerifyView.vue Visa fil

7
 <script>
7
 <script>
8
 import { currentProfile, authenticator } from '../services'
8
 import { currentProfile, authenticator } from '../services'
9
 let hash = null
9
 let hash = null
10
-let hashedAccessToken = null
11
 export default {
10
 export default {
12
     name: 'VerifyView',
11
     name: 'VerifyView',
13
     async created() {
12
     async created() {
14
         hash = this.$route.params.hashedToken
13
         hash = this.$route.params.hashedToken
15
-        hashedAccessToken = authenticator.grabStoredCookie('siimee_access')
16
         try {
14
         try {
17
             this.isHashInUrl(hash)
15
             this.isHashInUrl(hash)
18
-            await this.doesAccessTokenExist(hashedAccessToken)
19
             await this.verifyActiveSession(hash)
16
             await this.verifyActiveSession(hash)
20
             const sessionData =
17
             const sessionData =
21
                 await authenticator.verifySessionCookie('siimee_session')
18
                 await authenticator.verifySessionCookie('siimee_session')
33
         isHashInUrl(hash) {
30
         isHashInUrl(hash) {
34
             if (!hash) throw new Error('URL contains no hash!')
31
             if (!hash) throw new Error('URL contains no hash!')
35
         },
32
         },
36
-        async doesAccessTokenExist(hashedAccessToken) {
37
-            if (!hashedAccessToken)
38
-                throw new Error('accessToken not in cookie store!')
39
-        },
40
         async verifyActiveSession(hashedToken) {
33
         async verifyActiveSession(hashedToken) {
41
             const sessionData = await authenticator.verifySession(hashedToken)
34
             const sessionData = await authenticator.verifySession(hashedToken)
42
             if (!sessionData.hashesMatch)
35
             if (!sessionData.hashesMatch)

Laddar…
Avbryt
Spara