Skip to content

Commit 141e12a

Browse files
committed
[fix] Blank page on invalid session token
When the browser has an auth session token that is not found on server side, then a blank page was loaded. As a workaround the user had to manually clear the token from the browser and reload the page. Now we redirect the user back to the login page when this situation occurs. The problem was that the "authParams" was cached in a state that its "sessionStillActive" field is false. Now these auth parameters are not cached but loaded from the server.
1 parent ff0c03d commit 141e12a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

web/server/vue-cli/src/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ router.beforeResolve((to, from, next) => {
6464
store.dispatch(GET_AUTH_PARAMS).then(() => {
6565
if (to.matched.some(record => record.meta.requiresAuth)) {
6666
if (store.getters.authParams.requiresAuthentication &&
67-
!store.getters.isAuthenticated
67+
(!store.getters.authParams.sessionStillActive ||
68+
!store.getters.isAuthenticated)
6869
) {
6970
// Redirect the user to the login page but keep the original path to
7071
// redirect the user back once logged in.

web/server/vue-cli/src/store/modules/auth.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ const getters = {
3737

3838
const actions = {
3939
[GET_AUTH_PARAMS]({ commit }) {
40-
if (state.authParams) return state.authParams;
41-
4240
return new Promise(resolve => {
4341
authService.getClient().getAuthParameters(
4442
handleThriftError(params => {

web/server/vue-cli/src/views/Login.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ export default {
167167
168168
computed: {
169169
...mapGetters([
170+
"authParams",
170171
"isAuthenticated"
171172
]),
172173
ssoButtonText() {
@@ -185,7 +186,7 @@ export default {
185186
},
186187
187188
created() {
188-
if (this.isAuthenticated) {
189+
if (this.isAuthenticated && this.authParams.sessionStillActive) {
189190
const returnTo = this.$router.currentRoute.query["return_to"];
190191
this.$router.replace(returnTo || { name: "products" });
191192
}

0 commit comments

Comments
 (0)