@@ -47,15 +47,19 @@ export default function getRouter(basePath = '/') {
4747 name : 'FormCreate' ,
4848 component : ( ) => import ( /* webpackChunkName: "create" */ '@/views/form/Create.vue' ) ,
4949 meta : {
50- breadcrumbTitle : 'Form Designer'
50+ breadcrumbTitle : 'Form Designer' ,
51+ requiresAuth : true ,
52+ hasLogin : true
5153 } ,
5254 } ,
5355 {
5456 path : 'design' ,
5557 name : 'FormDesigner' ,
5658 component : ( ) => import ( /* webpackChunkName: "designer" */ '@/views/form/Design.vue' ) ,
5759 meta : {
58- breadcrumbTitle : 'Form Designer'
60+ breadcrumbTitle : 'Form Designer' ,
61+ requiresAuth : true ,
62+ hasLogin : true
5963 } ,
6064 props : createProps
6165 } ,
@@ -64,7 +68,9 @@ export default function getRouter(basePath = '/') {
6468 name : 'FormManage' ,
6569 component : ( ) => import ( /* webpackChunkName: "manage" */ '@/views/form/Manage.vue' ) ,
6670 meta : {
67- breadcrumbTitle : 'Manage Form'
71+ breadcrumbTitle : 'Manage Form' ,
72+ requiresAuth : true ,
73+ hasLogin : true
6874 } ,
6975 props : createProps
7076 } ,
@@ -73,7 +79,9 @@ export default function getRouter(basePath = '/') {
7379 name : 'FormPreview' ,
7480 component : ( ) => import ( /* webpackChunkName: "viewsubmission" */ '@/views/form/Preview.vue' ) ,
7581 meta : {
76- breadcrumbTitle : 'Preview Form'
82+ breadcrumbTitle : 'Preview Form' ,
83+ requiresAuth : true ,
84+ hasLogin : true
7785 } ,
7886 props : createProps
7987 } ,
@@ -82,7 +90,9 @@ export default function getRouter(basePath = '/') {
8290 name : 'FormSubmissions' ,
8391 component : ( ) => import ( /* webpackChunkName: "submissions" */ '@/views/form/Submissions.vue' ) ,
8492 meta : {
85- breadcrumbTitle : 'Submissions'
93+ breadcrumbTitle : 'Submissions' ,
94+ requiresAuth : true ,
95+ hasLogin : true
8696 } ,
8797 props : createProps
8898 } ,
@@ -111,7 +121,9 @@ export default function getRouter(basePath = '/') {
111121 name : 'FormTeams' ,
112122 component : ( ) => import ( /* webpackChunkName: "teams" */ '@/views/form/Teams.vue' ) ,
113123 meta : {
114- breadcrumbTitle : 'Team Management'
124+ breadcrumbTitle : 'Team Management' ,
125+ requiresAuth : true ,
126+ hasLogin : true
115127 } ,
116128 props : createProps
117129 } ,
@@ -120,15 +132,13 @@ export default function getRouter(basePath = '/') {
120132 name : 'FormView' ,
121133 component : ( ) => import ( /* webpackChunkName: "viewsubmission" */ '@/views/form/View.vue' ) ,
122134 meta : {
123- breadcrumbTitle : 'View Submission'
135+ breadcrumbTitle : 'View Submission' ,
136+ requiresAuth : true ,
137+ hasLogin : true
124138 } ,
125139 props : createProps
126140 } ,
127- ] ,
128- meta : {
129- requiresAuth : true ,
130- hasLogin : true
131- }
141+ ]
132142 } ,
133143 {
134144 path : '/user' ,
@@ -193,13 +203,15 @@ export default function getRouter(basePath = '/') {
193203 }
194204
195205 // Force login redirect if not authenticated
206+ // Note some pages (Submit and Success) only require auth if the form being loaded is secured
207+ // in those cases, see the navigation gaurds in their views for auth loop
196208 if ( to . matched . some ( route => route . meta . requiresAuth )
197209 && router . app . $keycloak
198210 && router . app . $keycloak . ready
199211 && ! router . app . $keycloak . authenticated ) {
200212 const redirect = location . origin + basePath + to . path + location . search ;
201213 const loginUrl = router . app . $keycloak . createLoginUrl ( {
202- // idpHint: 'idir',
214+ idpHint : 'idir' ,
203215 redirectUri : redirect
204216 } ) ;
205217 window . location . replace ( loginUrl ) ;
0 commit comments