Skip to content

Commit

Permalink
fix(auth): auth cookie being remove (#2198)
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin808 authored Dec 18, 2023
2 parents 519f0c4 + cb6a743 commit 125bcf7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 38 deletions.
23 changes: 0 additions & 23 deletions cypress/integration/login/login.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,6 @@

const { email, password } = Cypress.env('user');

describe('test for EXPIRED or INVALID token ', () => {
it('APP_SID should be removed when user go to homepage', () => {
cy.visit('/login/');
cy.get("input[name='email']").should('exist').type(email);
cy.get("input[name='password']").should('exist').type(password);
cy.get("button[type='submit']").should('exist').click();
cy.wait(2000);

cy.getCookie('APP_SID').should('exist');
cy.get("[data-testid='instancesContainer']", { timeout: 30000 }).should(
'exist',
);

cy.setCookie('APP_SID', 'mock-token');

cy.visit('/');

cy.wait(1000);

cy.getCookie('APP_SID').should('not.exist');
});
});

describe('test for VALID token ', () => {
it('APP_SID should NOT be removed when user go to homepage', () => {
cy.visit('/login/');
Expand Down
16 changes: 1 addition & 15 deletions src/utils/resetCookie.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,7 @@ import { deleteCookie } from 'cookies-next';
* @param {boolean} isProd - boolean current environment
*
*/
export const resetCookies = (isProd) => {
if (isProd) {
deleteCookie('APP_SID', {
domain: '.zesty.io',
secure: true,
});
} else {
deleteCookie('DEV_APP_SID', {
domain: '.zesty.io',
secure: true,
});
}
deleteCookie(isProd ? 'APP_SID' : 'DEV_APP_SID', {
domain: '.zesty.io',
});
export const resetCookies = () => {
deleteCookie('isAuthenticated');
deleteCookie('ZESTY_WORKING_INSTANCE', {});
deleteCookie('APP_USER_ZUID');
Expand Down

0 comments on commit 125bcf7

Please sign in to comment.