diff --git a/src/App.vue b/src/App.vue index 8a852e38..51ef7b26 100644 --- a/src/App.vue +++ b/src/App.vue @@ -173,56 +173,56 @@ export default { this.isSubscribed = isSubscribed; }) - if(this.authToken && !window.location.pathname.includes("/form")){ + if(this.authToken && !window.location.hash.includes("/form")){ this.$store.dispatch('getApps',this.authToken); this.$store.dispatch('getTeammates',this.authToken); } eventBus.$on("UpdateThemeEvent", (themeData) => { Object.assign(this.themeData, { ...themeData }) - this.isForm = window.location.pathname.includes("/form") ? true : false + this.isForm = window.location.hash.includes("/form") ? true : false }) if(this.$route.meta.admin){ this.showNavbar = - window.location.pathname.includes("/admin/participants") || - window.location.pathname.includes("/admin/events") || - window.location.pathname.includes("/admin/dashboard") || - window.location.pathname.includes("/admin/subscription") || - window.location.pathname.includes("/admin/teams") || - window.location.pathname.includes("/admin/setting/org") || - window.location.pathname.includes("/admin/createapp") || - window.location.pathname.includes("/admin/marketplace") ? + window.location.hash.includes("/admin/participants") || + window.location.hash.includes("/admin/events") || + window.location.hash.includes("/admin/dashboard") || + window.location.hash.includes("/admin/subscription") || + window.location.hash.includes("/admin/teams") || + window.location.hash.includes("/admin/setting/org") || + window.location.hash.includes("/admin/createapp") || + window.location.hash.includes("/admin/marketplace") ? true : false; }else{ - this.showUserNav = window.location.pathname.includes("/form") || window.location.pathname.includes('/auth/google') || - window.location.pathname.includes("/user") || window.location.pathname.includes("/sa/home")?true : false - this.isForm= window.location.pathname.includes("/form")? true:false + this.showUserNav = window.location.hash.includes("/form") || window.location.pathname.includes('/auth/google') || + window.location.hash.includes("/user") || window.location.hash.includes("/sa/home")?true : false + this.isForm= window.location.hash.includes("/form")? true:false } }, updated() { this.showNavbar = - window.location.pathname.includes("/admin/participants") || - window.location.pathname.includes("/admin/events") || - window.location.pathname.includes("/admin/dashboard") || - window.location.pathname.includes("/admin/subscription") || - window.location.pathname.includes("/admin/teams") || - window.location.pathname.includes("/admin/setting/org") || - window.location.pathname.includes("/admin/createapp") || - window.location.pathname.includes("/admin/marketplace") ? + window.location.hash.includes("/admin/participants") || + window.location.hash.includes("/admin/events") || + window.location.hash.includes("/admin/dashboard") || + window.location.hash.includes("/admin/subscription") || + window.location.hash.includes("/admin/teams") || + window.location.hash.includes("/admin/setting/org") || + window.location.hash.includes("/admin/createapp") || + window.location.hash.includes("/admin/marketplace") ? true : false; this.showChat = - window.location.pathname.includes("/admin/participants") || - window.location.pathname.includes("/admin/events") || - window.location.pathname.includes("/admin/dashboard") || - window.location.pathname.includes("/admin/subscription") || - window.location.pathname.includes("/admin/teams") || - window.location.pathname.includes("/admin/setting/org") || - window.location.pathname.includes("/admin/createapp") || - window.location.pathname.includes("/admin/marketplace") ? + window.location.hash.includes("/admin/participants") || + window.location.hash.includes("/admin/events") || + window.location.hash.includes("/admin/dashboard") || + window.location.hash.includes("/admin/subscription") || + window.location.hash.includes("/admin/teams") || + window.location.hash.includes("/admin/setting/org") || + window.location.hash.includes("/admin/createapp") || + window.location.hash.includes("/admin/marketplace") ? true : false; - this.showUserNav = window.location.pathname.includes("/admin") || window.location.pathname.includes("/auth/google")?false : true + this.showUserNav = window.location.hash.includes("/admin") || window.location.pathname.includes("/auth/google")?false : true }, methods: { @@ -260,13 +260,13 @@ export default { }, onItemClick() { if ( - window.location.pathname.includes("investors") || - window.location.pathname.includes("project") || - window.location.pathname.includes("dashboard") || - window.location.pathname.includes("/admin/subscription")|| - window.location.pathname.includes("/admin/teams") || - window.location.pathname.includes("/admin/createapp") || - window.location.pathname.includes("/admin/marketplace") + window.location.hash.includes("investors") || + window.location.hash.includes("project") || + window.location.hash.includes("dashboard") || + window.location.hash.includes("/admin/subscription")|| + window.location.hash.includes("/admin/teams") || + window.location.hash.includes("/admin/createapp") || + window.location.hash.includes("/admin/marketplace") ) { this.showNavbar = true; } else { diff --git a/src/components/login/Auth.vue b/src/components/login/Auth.vue index 03427764..ba38b724 100644 --- a/src/components/login/Auth.vue +++ b/src/components/login/Auth.vue @@ -9,9 +9,9 @@ export default { components: {}, async mounted() { - const routeHash = this.$route.hash; - const accessToken = routeHash.split("&")[0].split("=")[1]; - const authToken = routeHash.split("&")[5].split("=")[1]; + const routeHash = this.$route + const accessToken = routeHash.query['/access_token'] + const authToken = routeHash.query['id_token'] const payload = { provider: 'Google', accessToken, diff --git a/src/mixins/loginWithGoogle.js b/src/mixins/loginWithGoogle.js index ee1934ee..017a997a 100644 --- a/src/mixins/loginWithGoogle.js +++ b/src/mixins/loginWithGoogle.js @@ -6,7 +6,7 @@ export default{ webAuth.authorize( { connection: "google-oauth2", - redirectUri: window.location.origin + "/auth/google?", + redirectUri: window.location.origin + "/#/auth/google?", }); diff --git a/src/router.js b/src/router.js index 2e39965d..9f456bdb 100644 --- a/src/router.js +++ b/src/router.js @@ -7,197 +7,211 @@ import Auth from './components/login/Auth' Vue.use(Router); const router = new Router({ - mode: "history", + mode: "hash", routes: [{ - path: "/form/:slug", - name: "Event", - component: () => - import ( - /* webpackChunkName: "investorLogin" */ - "./views/participant/Event.vue" - ), - meta: (route) => ({ - requiresAuth: false, - title: `${config.appName} - ` + route.params.slug, - tabbar: false, - }), - }, - { - path: "/user/home/", - name: "Home", - component: () => - import ( - /* webpackChunkName: "investorLogin" */ - "./views/participant/Home.vue" - ), - meta: () => ({ requiresAuth: true, title: `${config.appName} - User Home` }) - }, - { - path: "/", - redirect: "/admin/login", - }, - { - path: "/app", - redirect: "/admin/login", - }, - { - path: "/admin", - redirect: "/admin/login", - }, - { - path: "/invitation", - name: "Invitation", - component: () => - import ( /* webpackChunkName: "adminLogin" */ "./views/Invitation.vue"), - }, - - { - path:'/auth/google', - component:Auth - }, - { - path: "/admin/login", - name: "AdminLogin", + path: "/form/:slug", + name: "Event", + component: () => + import( + /* webpackChunkName: "investorLogin" */ + "./views/participant/Event.vue" + ), + meta: (route) => ({ + requiresAuth: false, + title: `${config.appName} - ` + route.params.slug, + tabbar: false, + }), + }, + { + path: "/user/home/", + name: "Home", + component: () => + import( + /* webpackChunkName: "investorLogin" */ + "./views/participant/Home.vue" + ), + meta: () => ({ requiresAuth: true, title: `${config.appName} - User Home` }) + }, + { + path: "/", + redirect: "/admin/login", + }, + { + path: "/app", + redirect: "/admin/login", + }, + { + path: "/admin", + redirect: "/admin/login", + }, + { + path: "/invitation", + name: "Invitation", + component: () => + import( /* webpackChunkName: "adminLogin" */ "./views/Invitation.vue"), + }, - component: () => - import ( /* webpackChunkName: "adminLogin" */ './views/admin/AdminLogin.vue'), - meta: () => ({ requiresAuth: true, title: `${config.appName} - Admin Login`, tabbar: false }) - }, - { - path: "/404", - name: "PageNotFound", + { + path: "/admin/login", + name: "AdminLogin", - component: () => - import ( /* webpackChunkName: "adminLogin" */ './views/404.vue'), - meta: { - title: `${config.appName} - 404` - } - }, - { - path: "/admin/dashboard", - name: "Dashboard", - component: () => - import ( - /* webpackChunkName: "dashboard" */ - "./views/admin/Dashboard.vue" - ), - meta: { - requiresAuth: true, - admin: true, - title: `${config.appName} - Admin Dashboard` - }, + component: () => + import( /* webpackChunkName: "adminLogin" */ './views/admin/AdminLogin.vue'), + meta: () => ({ requiresAuth: true, title: `${config.appName} - Admin Login`, tabbar: false }) + + }, + { + path: '/auth/google', + component: Auth, + + }, + { + name:"Auth0Redirect", + path: "/access_token=*", + meta:{ + name: "Access Token", + } + + }, + + { + path: "/404", + name: "PageNotFound", + + component: () => + import( /* webpackChunkName: "adminLogin" */ './views/404.vue'), + meta: { + title: `${config.appName} - 404` + } + }, + { + path: "/admin/dashboard", + name: "Dashboard", + component: () => + import( + /* webpackChunkName: "dashboard" */ + "./views/admin/Dashboard.vue" + ), + meta: { + requiresAuth: true, + admin: true, + title: `${config.appName} - Admin Dashboard` }, - { - path: "/admin/teams", - name: "Teams", - component: () => - import ( - /* webpackChunkName: "dashboard" */ - "./views/admin/TeamMate.vue" - ), - meta: { - requiresAuth: true, - admin: true, - title: `${config.appName} - Teams` - }, + }, + { + path: "/admin/teams", + name: "Teams", + component: () => + import( + /* webpackChunkName: "dashboard" */ + "./views/admin/TeamMate.vue" + ), + meta: { + requiresAuth: true, + admin: true, + title: `${config.appName} - Teams` }, - { - path: "/admin/setting/org", - name: "Org", - component: () => - import ( - /* webpackChunkName: "dashboard" */ - "./views/admin/setting/OrgSetting.vue" - ), - meta: { - requiresAuth: true, - admin: true, - title: `${config.appName} - Org` - }, + }, + { + path: "/admin/setting/org", + name: "Org", + component: () => + import( + /* webpackChunkName: "dashboard" */ + "./views/admin/setting/OrgSetting.vue" + ), + meta: { + requiresAuth: true, + admin: true, + title: `${config.appName} - Org` }, - { - path: "/admin/createapp", - name: "CreateApp", - component: () => - import ( - /* webpackChunkName: "dashboard" */ - "./views/admin/CreateApp.vue" - ), - meta: { - requiresAuth: true, - admin: true, - title: `${config.appName} - CreateApp` - }, + }, + { + path: "/admin/createapp", + name: "CreateApp", + component: () => + import( + /* webpackChunkName: "dashboard" */ + "./views/admin/CreateApp.vue" + ), + meta: { + requiresAuth: true, + admin: true, + title: `${config.appName} - CreateApp` }, - { - path: "/admin/participants", - name: "Participants", - component: () => - import ( - /* webpackChunkName: "investors" */ - "./views/admin/Participants.vue" - ), - meta: { - requiresAuth: true, - admin: true, - title: `${config.appName} - Participants`, - }, + }, + { + path: "/admin/participants", + name: "Participants", + component: () => + import( + /* webpackChunkName: "investors" */ + "./views/admin/Participants.vue" + ), + meta: { + requiresAuth: true, + admin: true, + title: `${config.appName} - Participants`, }, - { - path: "/admin/events", - name: "Events", - component: () => - import ( /* webpackChunkName: "project" */ "./views/admin/Events.vue"), - meta: { - requiresAuth: true, - admin: true, - title: `${config.appName} - Events` - }, + }, + { + path: "/admin/events", + name: "Events", + component: () => + import( /* webpackChunkName: "project" */ "./views/admin/Events.vue"), + meta: { + requiresAuth: true, + admin: true, + title: `${config.appName} - Events` }, - { - path: "/admin/subscription", - name: "subscription", - component: () => - import ( - /* webpackChunkName: "subscription" */ - "./views/admin/Subscription.vue" - ), - meta: { - requiresAuth: true, - admin: true, - title: `${config.appName} - Subscription` - }, + }, + { + path: "/admin/subscription", + name: "subscription", + component: () => + import( + /* webpackChunkName: "subscription" */ + "./views/admin/Subscription.vue" + ), + meta: { + requiresAuth: true, + admin: true, + title: `${config.appName} - Subscription` }, - { - path: "/admin/marketplace", - name: "MarketPlace", - component: () => - import ( - /* webpackChunkName: "MarketPlace" */ - "./views/admin/MarketPlace.vue" - ), - meta: { - requiresAuth: true, - admin: true, - title: `${config.appName} - Marketplace` - }, + }, + { + path: "/admin/marketplace", + name: "MarketPlace", + component: () => + import( + /* webpackChunkName: "MarketPlace" */ + "./views/admin/MarketPlace.vue" + ), + meta: { + requiresAuth: true, + admin: true, + title: `${config.appName} - Marketplace` }, - { - path: "/sa/home", - name: "SuperAdmin Home", - component: () => - import ( /* webpackChunkName: "project" */ "./views/superAdmin/Home.vue"), - meta: { - requiresAuth: false, - admin: false, - title: `${config.appName} - SuperAdmin Home` - }, + }, + { + path: "/sa/home", + name: "SuperAdmin Home", + component: () => + import( /* webpackChunkName: "project" */ "./views/superAdmin/Home.vue"), + meta: { + requiresAuth: false, + admin: false, + title: `${config.appName} - SuperAdmin Home` }, + }, ], }); router.beforeEach((to, from, next) => { + if(to.name==="Auth0Redirect"){ + return router.replace('/auth/google?'+to.fullPath) + } if (to.matched.length < 1) { document.title = to.meta.title; @@ -215,11 +229,11 @@ router.beforeEach((to, from, next) => { } const url = `${config.studioServer.BASE_URL}hs/api/v2/auth/protected?usage=${usage}`; fetch(url, { - headers: { - Authorization: `Bearer ${authToken}`, - }, - method: "POST", - }) + headers: { + Authorization: `Bearer ${authToken}`, + }, + method: "POST", + }) .then((res) => res.json()) .then((json) => { if (json.status == 403) { @@ -276,7 +290,7 @@ router.beforeEach((to, from, next) => { path: to.meta.admin ? "/admin/login" : !to.query["referrer"] ? - `/login/${to.params["slug"]}` : `/login/${to.params["slug"]}?referrer=${to.query["referrer"]}`, + `/login/${to.params["slug"]}` : `/login/${to.params["slug"]}?referrer=${to.query["referrer"]}`, params: { nextUrl: to.fullPath }, }); } diff --git a/src/views/admin/Events.vue b/src/views/admin/Events.vue index fc1ec007..d741d8f7 100644 --- a/src/views/admin/Events.vue +++ b/src/views/admin/Events.vue @@ -349,7 +349,7 @@ i { > Participants ({{ project.investorsCount }})