Skip to content

Commit

Permalink
Fix login redirect (#777)
Browse files Browse the repository at this point in the history
  • Loading branch information
hsiang9431-amzn committed Jun 2, 2021
1 parent 35054f6 commit 46c93f3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions public/apps/account/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

import { HttpStart } from 'opensearch-dashboards/public';
import { API_AUTH_LOGOUT } from '../../../common';
import { API_AUTH_LOGOUT, LOGIN_PAGE_URI } from '../../../common';
import { API_ENDPOINT_ACCOUNT_INFO } from './constants';
import { AccountInfo } from './types';
import { httpGet, httpGetWithIgnores, httpPost } from '../configuration/utils/request-utils';
Expand All @@ -31,7 +31,9 @@ export async function fetchAccountInfoSafe(http: HttpStart): Promise<AccountInfo
export async function logout(http: HttpStart, logoutUrl?: string): Promise<void> {
await httpPost(http, API_AUTH_LOGOUT);
setShouldShowTenantPopup(null);
window.location.href = logoutUrl || `${http.basePath.serverBasePath}/app/login`;
const nextUrl = encodeURIComponent(http.basePath.serverBasePath);
window.location.href =
logoutUrl || `${http.basePath.serverBasePath}/app/login?nextUrl=${nextUrl}`;
}

export async function updateNewPassword(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

### Bug Fixes
* Fixing JSON parsing in SAML for strings that contain '\' character [#749](https://github.com/opensearch-project/security-dashboards-plugin/pull/749)
* Fix login redirect [#777](https://github.com/opensearch-project/security-dashboards-plugin/pull/777)

### Maintenance
* move issue templates to ISSUE_TEMPLATE [#758](https://github.com/opensearch-project/security-dashboards-plugin/pull/758)
Expand Down
4 changes: 2 additions & 2 deletions server/auth/types/basic/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ export class BasicAuthRoutes {
);
return response.redirected({
headers: {
location: `${this.coreSetup.http.basePath.serverBasePath}${LOGIN_PAGE_URI}`,
location: `${this.coreSetup.http.basePath.serverBasePath}`,
},
});
}
Expand Down Expand Up @@ -214,7 +214,7 @@ export class BasicAuthRoutes {
);
return response.redirected({
headers: {
location: `${this.coreSetup.http.basePath.serverBasePath}${LOGIN_PAGE_URI}`,
location: `${this.coreSetup.http.basePath.serverBasePath}`,
},
});
}
Expand Down

0 comments on commit 46c93f3

Please sign in to comment.