Skip to content
Snippets Groups Projects
Unverified Commit ce7b0df6 authored by Jae Bradley's avatar Jae Bradley Committed by GitHub
Browse files

Merge pull request #18210 from edx/LEARNER-5286-delete-user-cookies-when-retiring-user

LEARNER-5286: Remove cookies when retiring user
parents 48bff77b 4045eee5
No related merge requests found
......@@ -6,6 +6,7 @@ import { Button, Modal, Icon, InputText, StatusAlert } from '@edx/paragon/static
import StringUtils from 'edx-ui-toolkit/js/utils/string-utils';
import { deactivate } from '../AccountsClient';
import removeLoggedInCookies from './removeLoggedInCookies';
class StudentAccountDeletionConfirmationModal extends React.Component {
constructor(props) {
......@@ -29,6 +30,7 @@ class StudentAccountDeletionConfirmationModal extends React.Component {
handleConfirmationModalClose() {
this.props.onClose();
removeLoggedInCookies();
window.location.href = 'https://www.edx.org';
}
......
import cookie from 'js-cookie';
const removeLoggedInCookies = () => {
const hostname = window.location.hostname;
const isLocalhost = hostname.indexOf('localhost') >= 0;
const isStage = hostname.indexOf('stage') >= 0;
let domain = '.edx.org';
if (isLocalhost) {
domain = 'localhost';
} else if (isStage) {
domain = '.stage.edx.org';
}
cookie.remove('edxloggedin', { domain });
if (isLocalhost) {
// localhost doesn't have prefixes
cookie.remove('csrftoken', { domain });
cookie.remove('edx-user-info', { domain });
} else {
// does not take sandboxes into account
const prefix = isStage ? 'stage' : 'prod';
// both stage and prod csrf tokens are set to .edx.org
cookie.remove(`${prefix}-edx-csrftoken`, { domain: '.edx.org' });
cookie.remove(`${prefix}-edx-user-info`, { domain });
}
};
export default removeLoggedInCookies;
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment