Преглед изворни кода

:recycle: dont require auth to verify | slim verification check

neo
toj пре 2 година
родитељ
комит
89f284580b
2 измењених фајлова са 11 додато и 9 уклоњено
  1. 1
    1
      frontend/src/router/index.js
  2. 10
    8
      frontend/src/views/VerifyView.vue

+ 1
- 1
frontend/src/router/index.js Прегледај датотеку

@@ -70,7 +70,7 @@ const routes = [
70 70
         path: `/verify/:hashedToken?`,
71 71
         component: VerifyView,
72 72
         name: `VerifyView`,
73
-        meta: { requiresAuth: true, requiresCompleteProfile: false },
73
+        meta: { requiresAuth: false, requiresCompleteProfile: false },
74 74
     },
75 75
     {
76 76
         path: `/login`,

+ 10
- 8
frontend/src/views/VerifyView.vue Прегледај датотеку

@@ -11,21 +11,23 @@ export default {
11 11
     name: 'VerifyView',
12 12
     async created() {
13 13
         hash = this.$route.params.hashedToken
14
+        let sessionData = null
15
+        /** Confirm session with backend */
14 16
         try {
15 17
             if (!hash) throw new Error('URL contains no hash!')
16
-            const sessionData = await authenticator.verifySession(hash)
18
+            sessionData = await authenticator.verifySession(hash)
17 19
             if (!sessionData.hashesMatch)
18 20
                 throw new Error('Hash is not in activeSessions!')
19
-
20
-            await authenticator.checkSessionValid()
21
-            currentProfile.login(
22
-                sessionData.profileId,
23
-                this.$waveui.notify,
24
-                sessionData.accessToken,
25
-            )
26 21
         } catch (err) {
27 22
             console.error(err)
28 23
         }
24
+        /** Check if session was confirmed and is now valid */
25
+        await authenticator.checkSessionValid()
26
+        currentProfile.login(
27
+            sessionData.profileId,
28
+            this.$waveui.notify,
29
+            sessionData.accessToken,
30
+        )
29 31
         this.$router.push('/')
30 32
     }
31 33
 }

Loading…
Откажи
Сачувај