Skip to content

Commit

Permalink
fix logout for non oidc
Browse files Browse the repository at this point in the history
  • Loading branch information
vcmirko committed Jun 8, 2024
1 parent 74f89f4 commit 0bf5471
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions client/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,28 @@
}
},
logout() {
var userType=this.profile.type
TokenStorage.clear()
this.formConfig=undefined
this.refreshAuthenticated()
this.resetProfile()
axios.get(`${process.env.BASE_URL}api/v1/auth/logout`).then((res) => {
const logoutUrl = res.data?.data?.output?.logoutUrl
if (logoutUrl) {
location.replace(logoutUrl)
}
}).catch((err) => {
console.log(err)
this.$toast.error("Could not log out")
})
// added by mirko => redirect to login page if not oidc, no logout required, the token is simply removed
if(userType=="local" || userType=="ldap" || userType=="azuread"){
this.$router.replace({ name: "Login", query: {from: this.$route.fullPath} }).catch(err => {});
}
// to doublecheck (mdaugs) if this really needed, ...
if(userType=="oidc"){
axios.get(`${process.env.BASE_URL}api/v1/auth/logout`).then((res) => {
const logoutUrl = res.data?.data?.output?.logoutUrl
if (logoutUrl) {
location.replace(logoutUrl)
}
}).catch((err) => {
console.log(err)
this.$toast.error("Could not log out")
})
}
}
}
}
Expand Down

0 comments on commit 0bf5471

Please sign in to comment.