Skip to content

Commit

Permalink
fix(webui): better authorization redirection
Browse files Browse the repository at this point in the history
  • Loading branch information
shigma committed Apr 3, 2021
1 parent 22988d5 commit 7237377
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
1 change: 0 additions & 1 deletion packages/plugin-webui/client/components/button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
:title="disabled ? '' : title"
:class="['k-button', type, { solid, round, frameless }]"
:disabled="disabled"
@click.stop="$emit('click')"
>
<slot/>
</button>
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-webui/client/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ receive('expire', () => {

router.beforeEach((route) => {
if (route.meta.authority && !user.value) {
return '/login'
return history.state.forward === '/login' ? '/' : '/login'
}
})

Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-webui/client/views/layout/sidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import type { RouteMeta } from 'vue-router'
function isShown(meta: RouteMeta) {
if (meta.hidden) return false
if (meta.authority && meta.authority > 1 && meta.authority > user.value?.authority) return false
if (meta.authority > 1 && !(meta.authority <= user.value?.authority)) return false
return true
}
Expand Down
2 changes: 1 addition & 1 deletion packages/plugin-webui/client/views/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ receive('login', body => data.value = body)
watch(user, (value) => {
if (!value) return
router.push('/profile')
router.push(router.currentRoute.value.redirectedFrom?.fullPath || '/profile')
})
let timestamp = 0
Expand Down

0 comments on commit 7237377

Please sign in to comment.