Преглед на файлове

:pencil2: Fixed merge issues

juan-filtering-match-pool
tomit4 преди 2 години
родител
ревизия
5b24d19b03

+ 6
- 6
backend/lib/plugins/user.js Целия файл

@@ -12,11 +12,11 @@ const UserProfileCreateRoute = require('../routes/user/create-profile')
12 12
 const UserProfilesListRoute = require('../routes/user/list-profiles')
13 13
 const UserLoginRoute = require('../routes/user/login')
14 14
 const UserSignupRoute = require('../routes/user/signup')
15
-const UserEmailRoute = require('../routes/user/email.js')
16
-const UserVerifyActiveRoute = require('../routes/user/verifyactivesession.js')
17
-const UserGetSessionRoute = require('../routes/user/get-session.js')
18
-const UserValidateSessionRoute = require('../routes/user/validatesession.js')
19
-const UserRemoveSessionRoute = require('../routes/user/removesession.js')
15
+const UserEmailRoute = require('../routes/user/send-email.js')
16
+const UserVerifyActiveRoute = require('../routes/user/verify-session.js')
17
+const UserCreateTokenRoute = require('../routes/user/token.js')
18
+const UserValidateSessionRoute = require('../routes/user/validate-session.js')
19
+const UserRemoveSessionRoute = require('../routes/user/remove-session.js')
20 20
 const UserPassword = require('../routes/user/authentication')
21 21
 
22 22
 const UserService = require('../services/user')
@@ -56,7 +56,7 @@ module.exports = {
56 56
         await server.route(UserProfilesListRoute)
57 57
         await server.route(UserEmailRoute)
58 58
         await server.route(UserVerifyActiveRoute)
59
-        await server.route(UserGetSessionRoute)
59
+        await server.route(UserCreateTokenRoute)
60 60
         await server.route(UserValidateSessionRoute)
61 61
         await server.route(UserRemoveSessionRoute)
62 62
         await server.route(UserPassword)

backend/lib/routes/user/removesession.js → backend/lib/routes/user/remove-session.js Целия файл

@@ -8,14 +8,14 @@ const pluginConfig = {
8 8
     docs: {
9 9
         get: {
10 10
             description: 'removes sessionToken from activeSessions upon logout',
11
-            notes: 'on logout, activeSessions no longer holds onto user credentials',
11
+            notes: 'On logout, activeSessions no longer holds onto user credentials',
12 12
         },
13 13
     },
14 14
 }
15 15
 
16 16
 module.exports = {
17 17
     method: 'POST',
18
-    path: '/removesession',
18
+    path: '/remove-session',
19 19
     options: {
20 20
         ...pluginConfig.docs.get,
21 21
         tags: ['api'],

backend/lib/routes/user/email.js → backend/lib/routes/user/send-email.js Целия файл

@@ -14,7 +14,7 @@ const pluginConfig = {
14 14
 
15 15
 module.exports = {
16 16
     method: 'POST',
17
-    path: '/sendemail/',
17
+    path: '/send-email/',
18 18
     options: {
19 19
         ...pluginConfig.docs.get,
20 20
         tags: ['api'],

backend/lib/routes/user/get-session.js → backend/lib/routes/user/token.js Целия файл

@@ -6,15 +6,15 @@ const pluginConfig = {
6 6
     handlerType: 'authentication',
7 7
     docs: {
8 8
         get: {
9
-            description: 'gets session token for authentication',
10
-            notes: 'Gets session token for authentication',
9
+            description: 'creates session token for authentication',
10
+            notes: 'Creates session token for authentication',
11 11
         },
12 12
     },
13 13
 }
14 14
 
15 15
 module.exports = {
16 16
     method: 'POST',
17
-    path: '/get-session',
17
+    path: '/token',
18 18
     options: {
19 19
         ...pluginConfig.docs.get,
20 20
         tags: ['api'],

backend/lib/routes/user/validatesession.js → backend/lib/routes/user/validate-session.js Целия файл

@@ -8,14 +8,14 @@ const pluginConfig = {
8 8
     docs: {
9 9
         get: {
10 10
             description: 'validates session token for each step of survey',
11
-            notes: 'validates session token for each step of survey',
11
+            notes: 'Validates session token for each step of survey',
12 12
         },
13 13
     },
14 14
 }
15 15
 
16 16
 module.exports = {
17 17
     method: 'POST',
18
-    path: '/validatesession',
18
+    path: '/validate-session',
19 19
     options: {
20 20
         ...pluginConfig.docs.get,
21 21
         tags: ['api'],

backend/lib/routes/user/verifyactivesession.js → backend/lib/routes/user/verify-session.js Целия файл


+ 4
- 4
frontend/src/components/onboarding/Auth.vue Целия файл

@@ -44,10 +44,10 @@ export default {
44 44
                 password: userPass.val,
45 45
             })
46 46
             await this.createProfileForNewUser(newUserId, this.responses)
47
-            const sessionToken = await this.getSessionToken({
47
+            const sessionToken = await this.createToken({
48 48
                 ...this.answered,
49 49
             })
50
-            const sessionInfo = await authenticator.sendAuthEmail({
50
+            const sessionInfo = await authenticator.sendEmail({
51 51
                 ...this.answered,
52 52
                 sessionToken: sessionToken,
53 53
             })
@@ -65,8 +65,8 @@ export default {
65 65
                     'User has not answered minimum amount of questions to create profile',
66 66
                 )
67 67
         },
68
-        async getSessionToken(payload) {
69
-            return await authenticator.getSessionToken({
68
+        async createToken(payload) {
69
+            return await authenticator.createToken({
70 70
                 payload,
71 71
             })
72 72
         },

+ 7
- 2
frontend/src/components/onboarding/QuestionResponse.vue Целия файл

@@ -28,9 +28,10 @@ export default {
28 28
             type: Number,
29 29
             required: true,
30 30
         },
31
-        surveyStepsCount: {
32
-            type: Number,
31
+        survey: {
32
+            type: Object,
33 33
             required: true,
34
+            default: () => {},
34 35
         },
35 36
     },
36 37
     emits: ['update-answers'],
@@ -38,7 +39,11 @@ export default {
38 39
         radioItems: [1, 2, 3, 4, 5],
39 40
         answer: null,
40 41
         noChoiceMade: null,
42
+        surveyStepsCount: null,
41 43
     }),
44
+    created() {
45
+        this.surveyStepsCount = this.survey?.steps.length
46
+    },
42 47
     methods: {
43 48
         onUpdate(index) {
44 49
             this.noChoiceMade = false

+ 7
- 7
frontend/src/services/auth.service.js Целия файл

@@ -4,23 +4,23 @@ class Authenticator {
4 4
     constructor() {
5 5
         this.currentUser = null
6 6
     }
7
-    async sendAuthEmail(answered) {
8
-        return await db.post('/user/sendemail/', answered)
7
+    async sendEmail(answered) {
8
+        return await db.post('/user/send-email/', answered)
9 9
     }
10
-    async verifyAuthSession(hashedToken) {
10
+    async verifySession(hashedToken) {
11 11
         return await db.get(`/user/verify/${hashedToken}`)
12 12
     }
13
-    async getSessionToken(req) {
14
-        return await db.post('/user/get-session', req, true)
13
+    async createToken(req) {
14
+        return await db.post('/user/token', req, true)
15 15
     }
16 16
     async validateSession(hashedSessionToken) {
17
-        return await db.post('/user/validatesession', hashedSessionToken, true)
17
+        return await db.post('/user/validate-session', hashedSessionToken, true)
18 18
     }
19 19
     async authenticateLoginCredentials(credentials) {
20 20
         return await db.post('/user/login', credentials)
21 21
     }
22 22
     async removeSession(hashedSessionToken) {
23
-        return await db.post('/user/removesession', hashedSessionToken, true)
23
+        return await db.post('/user/remove-session', hashedSessionToken, true)
24 24
     }
25 25
     grabStoredCookie(cookieKey) {
26 26
         const cookies = document.cookie.split('; ').reduce((prev, current) => {

+ 1
- 1
frontend/src/views/LoginView.vue Целия файл

@@ -35,7 +35,7 @@ export default {
35 35
                     loginCredentials,
36 36
                 )
37 37
             // emailSentSuccessfully: emailSent.wasSuccessfull,
38
-            const sessionInfo = await authenticator.sendAuthEmail({
38
+            const sessionInfo = await authenticator.sendEmail({
39 39
                 ...credentials.answered,
40 40
                 sessionToken: credentials.jwt,
41 41
             })

+ 0
- 1
frontend/src/views/OnboardingView.vue Целия файл

@@ -15,7 +15,6 @@ main.view--onboarding
15 15
                 :question='step'
16 16
                 :responses='responses'
17 17
                 :survey='survey'
18
-                :surveyStepsCount='survey?.steps?.length'
19 18
                 @handle-submit='onSubmit'
20 19
                 @update-answers='updateAnswers'
21 20
                 v-if='step && currentStep == i'

+ 1
- 2
frontend/src/views/VerifyView.vue Целия файл

@@ -38,8 +38,7 @@ export default {
38 38
                 throw new Error('accessToken not in cookie store!')
39 39
         },
40 40
         async verifyActiveSession(hashedToken) {
41
-            const sessionData =
42
-                await authenticator.verifyAuthSession(hashedToken)
41
+            const sessionData = await authenticator.verifySession(hashedToken)
43 42
             if (!sessionData.hashesMatch)
44 43
                 throw new Error('Hash is not in activeSessions!')
45 44
         },

Loading…
Отказ
Запис