@@ -47,15 +47,19 @@ export default function getRouter(basePath = '/') {
47
47
name : 'FormCreate' ,
48
48
component : ( ) => import ( /* webpackChunkName: "create" */ '@/views/form/Create.vue' ) ,
49
49
meta : {
50
- breadcrumbTitle : 'Form Designer'
50
+ breadcrumbTitle : 'Form Designer' ,
51
+ requiresAuth : true ,
52
+ hasLogin : true
51
53
} ,
52
54
} ,
53
55
{
54
56
path : 'design' ,
55
57
name : 'FormDesigner' ,
56
58
component : ( ) => import ( /* webpackChunkName: "designer" */ '@/views/form/Design.vue' ) ,
57
59
meta : {
58
- breadcrumbTitle : 'Form Designer'
60
+ breadcrumbTitle : 'Form Designer' ,
61
+ requiresAuth : true ,
62
+ hasLogin : true
59
63
} ,
60
64
props : createProps
61
65
} ,
@@ -64,7 +68,9 @@ export default function getRouter(basePath = '/') {
64
68
name : 'FormManage' ,
65
69
component : ( ) => import ( /* webpackChunkName: "manage" */ '@/views/form/Manage.vue' ) ,
66
70
meta : {
67
- breadcrumbTitle : 'Manage Form'
71
+ breadcrumbTitle : 'Manage Form' ,
72
+ requiresAuth : true ,
73
+ hasLogin : true
68
74
} ,
69
75
props : createProps
70
76
} ,
@@ -73,7 +79,9 @@ export default function getRouter(basePath = '/') {
73
79
name : 'FormPreview' ,
74
80
component : ( ) => import ( /* webpackChunkName: "viewsubmission" */ '@/views/form/Preview.vue' ) ,
75
81
meta : {
76
- breadcrumbTitle : 'Preview Form'
82
+ breadcrumbTitle : 'Preview Form' ,
83
+ requiresAuth : true ,
84
+ hasLogin : true
77
85
} ,
78
86
props : createProps
79
87
} ,
@@ -82,7 +90,9 @@ export default function getRouter(basePath = '/') {
82
90
name : 'FormSubmissions' ,
83
91
component : ( ) => import ( /* webpackChunkName: "submissions" */ '@/views/form/Submissions.vue' ) ,
84
92
meta : {
85
- breadcrumbTitle : 'Submissions'
93
+ breadcrumbTitle : 'Submissions' ,
94
+ requiresAuth : true ,
95
+ hasLogin : true
86
96
} ,
87
97
props : createProps
88
98
} ,
@@ -111,7 +121,9 @@ export default function getRouter(basePath = '/') {
111
121
name : 'FormTeams' ,
112
122
component : ( ) => import ( /* webpackChunkName: "teams" */ '@/views/form/Teams.vue' ) ,
113
123
meta : {
114
- breadcrumbTitle : 'Team Management'
124
+ breadcrumbTitle : 'Team Management' ,
125
+ requiresAuth : true ,
126
+ hasLogin : true
115
127
} ,
116
128
props : createProps
117
129
} ,
@@ -120,15 +132,13 @@ export default function getRouter(basePath = '/') {
120
132
name : 'FormView' ,
121
133
component : ( ) => import ( /* webpackChunkName: "viewsubmission" */ '@/views/form/View.vue' ) ,
122
134
meta : {
123
- breadcrumbTitle : 'View Submission'
135
+ breadcrumbTitle : 'View Submission' ,
136
+ requiresAuth : true ,
137
+ hasLogin : true
124
138
} ,
125
139
props : createProps
126
140
} ,
127
- ] ,
128
- meta : {
129
- requiresAuth : true ,
130
- hasLogin : true
131
- }
141
+ ]
132
142
} ,
133
143
{
134
144
path : '/user' ,
@@ -193,13 +203,15 @@ export default function getRouter(basePath = '/') {
193
203
}
194
204
195
205
// 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
196
208
if ( to . matched . some ( route => route . meta . requiresAuth )
197
209
&& router . app . $keycloak
198
210
&& router . app . $keycloak . ready
199
211
&& ! router . app . $keycloak . authenticated ) {
200
212
const redirect = location . origin + basePath + to . path + location . search ;
201
213
const loginUrl = router . app . $keycloak . createLoginUrl ( {
202
- // idpHint: 'idir',
214
+ idpHint : 'idir' ,
203
215
redirectUri : redirect
204
216
} ) ;
205
217
window . location . replace ( loginUrl ) ;
0 commit comments