Parcourir la source

:adhesive_bandages: Fix splash page not showing up by default

brian_auth_fix
tomit4 il y a 2 ans
Parent
révision
1481af21cd

+ 1
- 1
backend/lib/routes/user/validate-session.js Voir le fichier

@@ -85,7 +85,7 @@ module.exports = {
85 85
                 return {
86 86
                     ok: false,
87 87
                     handler: pluginConfig.handlerType,
88
-                    data: { error: err },
88
+                    data: { error: err.message },
89 89
                 }
90 90
             }
91 91
         },

+ 1
- 3
frontend/src/router/guards.js Voir le fichier

@@ -4,14 +4,12 @@ import { authenticator, currentProfile } from '../services'
4 4
 const DEV_MODE = import.meta.env.VITE_DEV == 'true'
5 5
 
6 6
 async function log(to) {
7
-    // if (DEV_MODE) {
8 7
     if (!currentProfile.isLoggedIn || !currentProfile.isComplete) {
9 8
         console.info(
10 9
             `[Guard Status debug]: Profile: ${currentProfile.id.value} | Login: ${currentProfile.isLoggedIn} | Complete: ${currentProfile.isComplete}`,
11 10
         )
12 11
     }
13 12
     console.info('[Guard Status debug]: being routed to:', to.fullPath)
14
-    // }
15 13
 }
16 14
 
17 15
 const loginIfToken = async () => {
@@ -35,7 +33,7 @@ const checkLoginStatus = async (destination, nextCb) => {
35 33
     if (DEV_MODE) {
36 34
         nextCb()
37 35
     } else if (
38
-        destination.meta.requiresCompleteProfile &&
36
+        destination.meta.requiresAuth &&
39 37
         !currentProfile.isLoggedIn &&
40 38
         !currentProfile.isComplete
41 39
     ) {

+ 1
- 1
frontend/src/router/index.js Voir le fichier

@@ -64,7 +64,7 @@ const routes = [
64 64
         path: `/onboarding/`,
65 65
         component: OnboardingView,
66 66
         name: `OnboardingView`,
67
-        meta: { requiresAuth: true, requiresCompleteProfile: false },
67
+        meta: { requiresAuth: false, requiresCompleteProfile: false },
68 68
     },
69 69
     // We must be able to get to this route BEFORE login to activate the session
70 70
     {

+ 1
- 1
frontend/src/services/auth.service.js Voir le fichier

@@ -24,10 +24,10 @@ class Authenticator {
24 24
         let validation
25 25
         try {
26 26
             validation = await db.post('/user/validate-session', hash, true)
27
+            if (validation.error) throw new Error(validation.error)
27 28
         } catch (error) {
28 29
             console.error(`Invalid session: ${error}`)
29 30
         }
30
-        console.log('valid Session :>> ', validation)
31 31
         return validation
32 32
     }
33 33
     async authenticateLoginCredentials(credentials) {

Chargement…
Annuler
Enregistrer