Skip to content

Commit

Permalink
Changed Logout to be a POST (#4668)
Browse files Browse the repository at this point in the history
Changed Logout to be a POST
  • Loading branch information
SandGrainOne authored Aug 25, 2020
1 parent d529111 commit 5912b9f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ await HttpContext.SignInAsync(
public async Task<IActionResult> Logout()
{
await HttpContext.SignOutAsync(CookieAuthenticationDefaults.AuthenticationScheme);
return LocalRedirect("/repos/user/logout");
return LocalRedirect("/");
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { Link } from 'react-router-dom';
import { IMenuItem, leftDrawerMenuSettings } from './drawerMenuSettings';
import { mainMenuSettings } from './drawerMenuSettings';
import { styles } from './tabletDrawerMenustyle';
import { post } from '../../utils/networking';

export interface ITabletDrawerMenuProps {
classes: any;
Expand Down Expand Up @@ -61,9 +62,11 @@ class TabletDrawerMenu extends React.Component<ITabletDrawerMenuProps & WithStyl
}

public handleLogout = () => {
if (window) {
window.location.href = '/Home/Logout';
}
const altinnWindow: Window = window;
const url = `${altinnWindow.location.origin}/repos/user/logout`;
post(url).then(() => {
window.location.assign(`${altinnWindow.location.origin}/Home/Logout`);
});
return true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import AccountCircle from '@material-ui/icons/AccountCircle';
import * as React from 'react';
import { IAltinnWindow } from '../../types';
import { altinnStudioDocsUrl, repositoryUrl } from '../../utils/urlHelper';
import { post } from '../../utils/networking';

export interface IProfileMenuComponentProps {
showlogout?: boolean;
Expand Down Expand Up @@ -51,10 +52,11 @@ class ProfileMenuComponent extends React.Component<IProfileMenuComponentProps, I
}

public handleLogout = () => {
this.setState({ anchorEl: null });
if (window) {
window.location.href = '/Home/Logout';
}
const altinnWindow: Window = window;
const url = `${altinnWindow.location.origin}/repos/user/logout`;
post(url).then(() => {
window.location.assign(`${altinnWindow.location.origin}/Home/Logout`);
});
return true;
}

Expand Down

0 comments on commit 5912b9f

Please sign in to comment.