浏览代码

:bug: Fixed verification errors

tags/0.0.4
tomit4 2 年前
父节点
当前提交
ed4c997214

+ 3
- 2
backend/lib/routes/profile/queue.js 查看文件

@@ -4,7 +4,6 @@ const Joi = require('joi')
4 4
 const apiSchema = require('../../schemas/api')
5 5
 const errorSchema = require('../../schemas/errors')
6 6
 const profileSchema = require('../../schemas/profiles')
7
-const params = require('../../schemas/params')
8 7
 
9 8
 const pluginConfig = {
10 9
     handlerType: 'profile',
@@ -22,7 +21,9 @@ const responseSchemas = {
22 21
 }
23 22
 
24 23
 const validators = {
25
-    params: params.profileId,
24
+    params: Joi.object({
25
+        profile_id: Joi.string(),
26
+    }),
26 27
     query: Joi.object({
27 28
         include_profile: Joi.bool(),
28 29
         limit: Joi.number(),

+ 2
- 3
backend/lib/routes/tag/get.js 查看文件

@@ -2,7 +2,6 @@
2 2
 
3 3
 const apiSchema = require('../../schemas/api')
4 4
 const errorSchema = require('../../schemas/errors')
5
-const params = require('../../schemas/params')
6 5
 const Joi = require('joi')
7 6
 
8 7
 const pluginConfig = {
@@ -20,8 +19,8 @@ const responseSchemas = {
20 19
 
21 20
 const validators = {
22 21
     params: Joi.object({
23
-        profile_id: params.profileId,
24
-        grouping_id: params.groupingId,
22
+        profile_id: Joi.string(),
23
+        grouping_id: Joi.string(),
25 24
     }),
26 25
     query: Joi.object({ category: Joi.string() }),
27 26
 }

+ 7
- 0
backend/lib/routes/user/verify-session.js 查看文件

@@ -12,6 +12,12 @@ const pluginConfig = {
12 12
     },
13 13
 }
14 14
 
15
+const validators = {
16
+    params: Joi.object({
17
+        hashedSessionToken: Joi.string(),
18
+    }),
19
+}
20
+
15 21
 module.exports = {
16 22
     method: 'GET',
17 23
     path: '/verify/{hashedSessionToken}',
@@ -69,6 +75,7 @@ module.exports = {
69 75
             }
70 76
         },
71 77
         validate: {
78
+            ...validators,
72 79
             failAction: 'log',
73 80
         },
74 81
         response: {

+ 1
- 2
frontend/src/services/auth.service.js 查看文件

@@ -36,8 +36,7 @@ class Authenticator {
36 36
         const hashedAccessToken = this.grabStoredCookie(sessionCookie)
37 37
         if (!hashedAccessToken)
38 38
             return console.warn('WARNING :=> accessToken is not defined')
39
-        const validatedToken =
40
-            await authenticator.validateSession(hashedAccessToken)
39
+        const validatedToken = await this.validateSession(hashedAccessToken)
41 40
         if (validatedToken.error) {
42 41
             console.error('ERROR :=>', validatedToken.error)
43 42
         } else {

+ 0
- 5
frontend/src/views/OnboardingView.vue 查看文件

@@ -58,11 +58,6 @@ export default {
58 58
             const sessionData =
59 59
                 await authenticator.verifySessionCookie('siimee_session')
60 60
             if (sessionData) {
61
-                await currentProfile.login(
62
-                    sessionData.profileId,
63
-                    this.$waveui.notify,
64
-                    sessionData.sessionToken,
65
-                )
66 61
                 this.responses = this.formatResponses(
67 62
                     currentProfile._profile.responses,
68 63
                 )

正在加载...
取消
保存