`${activeUser.user.first_name} ${activeUser.user.last_name}`);
})
+ it('logs out when token no longer valid', function() {
+ // 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');
+ // Invalidate own token.
+ const tokenUuid = activeUser.token.split('/')[1];
+ cy.doRequest('PUT', `/arvados/v1/api_client_authorizations/${tokenUuid}`, {
+ id: tokenUuid,
+ api_client_authorization: JSON.stringify({
+ api_token: `randomToken${Math.floor(Math.random() * Math.floor(999999))}`
+ })
+ }, null, activeUser.token, true);
+ // Should log the user out.
+ cy.get('[data-cy=breadcrumb-first]').click();
+ cy.get('div#root').should('contain', 'Please log in');
+ })
+
it('logs in successfully with valid admin token', function() {
cy.visit(`/token/?api_token=${adminUser.token}`);
cy.url().should('contain', '/projects/');
# SPDX-License-Identifier: AGPL-3.0
FROM node:8-buster
-MAINTAINER MAINTAINER Arvados Package Maintainers <packaging@arvados.org>
+LABEL maintainer="Arvados Package Maintainers <packaging@arvados.org>"
RUN echo deb http://deb.debian.org/debian buster-backports main >> /etc/apt/sources.list.d/backports.list
RUN apt-get update && \
import { ConnectedRouter } from "react-router-redux";
import { ApiToken } from "~/views-components/api-token/api-token";
import { AddSession } from "~/views-components/add-session/add-session";
-import { initAuth } from "~/store/auth/auth-action";
+import { initAuth, logout } from "~/store/auth/auth-action";
import { createServices } from "~/services/services";
import { MuiThemeProvider } from '@material-ui/core/styles';
import { CustomTheme } from '~/common/custom-theme';
if (showSnackBar) {
console.error("Backend error:", error);
- if (error.errors[0].indexOf("not found") > -1) {
+ if (error.status === 404) {
store.dispatch(openNotFoundDialog());
+ } else if (error.status === 401 && error.errors[0].indexOf("Not logged in") > -1) {
+ store.dispatch(logout());
} else {
store.dispatch(snackbarActions.OPEN_SNACKBAR({
message: `${error.errors
import * as QueryString from "query-string";
interface Errors {
+ status: number;
errors: string[];
errorToken: string;
}
.catch(({ response }) => {
actions.progressFn(reqId, false);
const errors = CommonService.mapResponseKeys(response) as Errors;
+ errors.status = response.status;
actions.errorFn(reqId, errors, showErrors);
throw errors;
});