[arvados-workbench2] updated: 2.5.0-4-ge92b9b54
git repository hosting
git at public.arvados.org
Thu Jan 19 19:48:22 UTC 2023
Summary of changes:
cypress/integration/login.spec.js | 18 +++++++++++++++---
src/index.tsx | 3 ++-
2 files changed, 17 insertions(+), 4 deletions(-)
via e92b9b5472a0f32e40983b8e25e572e592691e41 (commit)
via 6b9a82be8d59508134842191b705786efedd33bd (commit)
from 68abcff0f925ea12c0d74efdafbd6c74db82ae3b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit e92b9b5472a0f32e40983b8e25e572e592691e41
Author: Stephen Smith <stephen at curii.com>
Date: Thu Jan 19 14:48:05 2023 -0500
19715: Add test for preserving url location on auth invalidation
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>
diff --git a/cypress/integration/login.spec.js b/cypress/integration/login.spec.js
index aeea01cd..2c539e49 100644
--- a/cypress/integration/login.spec.js
+++ b/cypress/integration/login.spec.js
@@ -79,11 +79,18 @@ describe('Login tests', function() {
})
it('logs out when token no longer valid', function() {
+ cy.createProject({
+ owningUser: activeUser,
+ projectName: `Test Project ${Math.floor(Math.random() * 999999)}`,
+ addToFavorites: false
+ }).as('testProject1');
// Log in
cy.visit(`/token/?api_token=${activeUser.token}`);
cy.url().should('contain', '/projects/');
cy.get('div#root').should('contain', 'Arvados Workbench (zzzzz)');
cy.get('div#root').should('not.contain', 'Your account is inactive');
+ cy.waitForDom();
+
// Invalidate own token.
const tokenUuid = activeUser.token.split('/')[1];
cy.doRequest('PUT', `/arvados/v1/api_client_authorizations/${tokenUuid}`, {
@@ -93,8 +100,13 @@ describe('Login tests', function() {
})
}, null, activeUser.token, true);
// Should log the user out.
- cy.visit('/');
- cy.get('div#root').should('contain', 'Please log in');
+
+ cy.getAll('@testProject1').then(([testProject1]) => {
+ cy.get('main').contains(testProject1.name).click();
+ cy.get('div#root').should('contain', 'Please log in');
+ // Should retain last visited url when auth is invalidated
+ cy.url().should('contain', `/projects/${testProject1.uuid}`);
+ })
})
it('logs in successfully with valid admin token', function() {
@@ -131,4 +143,4 @@ describe('Login tests', function() {
cy.get('button[title="Account Management"]').click();
cy.get('ul[role=menu] > li[role=menuitem]').contains(randomUser.username);
})
-})
\ No newline at end of file
+})
commit 6b9a82be8d59508134842191b705786efedd33bd
Author: Stephen Smith <stephen at curii.com>
Date: Thu Jan 19 14:46:45 2023 -0500
19715: Preserve current url when api returns auth error
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>
diff --git a/src/index.tsx b/src/index.tsx
index c2142282..244d1387 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -132,7 +132,8 @@ fetchConfig()
if (error.status === 404) {
store.dispatch(openNotFoundDialog());
} else if (error.status === 401 && error.errors[0].indexOf("Not logged in") > -1) {
- store.dispatch(logout());
+ // Catch auth errors when navigating and redirect to login preserving url location
+ store.dispatch(logout(false, true));
} else {
store.dispatch(snackbarActions.OPEN_SNACKBAR({
message: `${error.errors
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list