Skip to content

Commit

Permalink
[AMORO-2637] Enable return back to origin uri when relogin (apache#2645)
Browse files Browse the repository at this point in the history
* [AMORO-2637] Enable return back to origin uri when redirecting to login page

* remove unused code

---------

Co-authored-by: wangtaohz <[email protected]>
  • Loading branch information
tcodehuber and wangtaohz authored Apr 10, 2024
1 parent 5faffab commit 6ef7171
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ams/dashboard/src/components/Topbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ export default defineComponent ({
.topbar-tooltip .ant-tooltip-inner {
font-size: 12px;
}
.logout-button {
border-color: transparent;
.logout-button.ant-btn {
border: none;
}
.logout-button:hover {
border-color: unset;
Expand Down
17 changes: 16 additions & 1 deletion ams/dashboard/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,21 @@ RegisterComponents(app);
(async () => {
try {
const store = useStore()

const fromPath = window.location.pathname
const fromQuery = window.location.search
if (!store.historyPathInfo.path && fromPath!='/login') {
const queryParams = new URLSearchParams(fromQuery)
const queryObj = {}
for (const [key, value] of queryParams.entries()) {
queryObj[key] = value
}
store.setHistoryPath({
path: fromPath,
query: queryObj
})
}

const token = getQueryString('token') || ''
const res = await loginService.getCurUserInfo(token)
if (res) {
Expand All @@ -70,8 +85,8 @@ RegisterComponents(app);
}
next()
})
app.use(router)

app.use(router)
app.mount('#app')
}
})()
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ public void preHandleRequest(Context ctx) {
ctx.queryParamMap());
} else if (needLoginCheck(uriPath)) {
if (null == ctx.sessionAttribute("user")) {
ctx.sessionAttributeMap();
LOG.info("session info: {}", JacksonUtil.toJSONString(ctx.sessionAttributeMap()));
throw new ForbiddenException();
}
Expand Down

0 comments on commit 6ef7171

Please sign in to comment.