Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/build_deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const build = (buildParameters: BuildParameters) => {
*/
return new Promise((resolve) => {
/* Run npm run build for these parameters. */
const proc = spawn('npm', ['run', 'build'], { timeout: 60000 });
const proc = spawn('npm', ['run', 'build'], { timeout: 300000 });

/* Print stdout. This is not necessary, strictly speaking, but is a good
* place to start if something goes wrong.
Expand Down Expand Up @@ -126,7 +126,7 @@ const main = async () => {
const hash = process.env.HASH || '';
const tag = process.env.TAG || '';
const keysSort = Object.keys(envs).sort();
const maxWorkers = 4;
const maxWorkers = 2;
/* Run at most maxWorkers builds at a time: */
const envGroups = chunk(keysSort, maxWorkers);
/* Wait for each group of builds to run for each environment in the group. */
Expand Down
6 changes: 3 additions & 3 deletions src/common/api/authService.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// import { store } from '../../app/store';
import { Me } from '../types/auth';
import { Me, MfaStatus } from '../types/auth';
import { uriEncodeTemplateTag as encode } from '../utils/stringUtils';
import { baseApi } from './index';
import { httpService } from './utils/serviceHelpers';
Expand All @@ -25,7 +25,7 @@ interface TokenResponse {
type: string;
user: string;
cachefor: number;
mfa: 'USED' | 'NOT_USED' | 'UNKNOWN';
mfa: MfaStatus;
}

interface AuthParams {
Expand Down Expand Up @@ -159,7 +159,7 @@ interface AuthResults {
device: string;
ip: string;
name?: string;
mfa: 'USED' | 'NOT_USED' | 'UNKNOWN';
mfa: MfaStatus;
}[];
user: string;
revokeallurl: string;
Expand Down
2 changes: 2 additions & 0 deletions src/common/types/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/* types/auth */
export type MfaStatus = 'Used' | 'NotUsed' | 'Unknown';

export interface Me {
anonid: string;
created: number;
Expand Down
18 changes: 12 additions & 6 deletions src/features/account/LogInSessions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,24 @@ import {
} from '@mui/material';
import { FC } from 'react';
import { getTokens, revokeToken } from '../../common/api/authService';
import { MfaStatus } from '../../common/types/auth';
import { Loader } from '../../common/components';
import { useAppSelector } from '../../common/hooks';
import { useLogout } from '../login/LogIn';

const mfaConfig: Record<
MfaStatus,
{ label: string; tooltip: string; color: string }
> = {
Used: { label: 'Y', tooltip: 'MFA used', color: 'green' },
NotUsed: { label: 'N', tooltip: 'Single factor', color: 'red' },
Unknown: { label: '?', tooltip: 'MFA status unknown', color: 'grey' },
};

export const MfaStatusIndicator: FC<{
mfa: 'USED' | 'NOT_USED' | 'UNKNOWN';
mfa: MfaStatus;
}> = ({ mfa }) => {
const config = {
USED: { label: 'Y', tooltip: 'MFA used', color: 'green' },
NOT_USED: { label: 'N', tooltip: 'Single factor', color: 'red' },
UNKNOWN: { label: '?', tooltip: 'MFA status unknown', color: 'grey' },
}[mfa];
const config = mfaConfig[mfa];
return (
<Tooltip title={config.tooltip}>
<span style={{ color: config.color, fontWeight: 'bold' }}>
Expand Down
4 changes: 2 additions & 2 deletions src/features/auth/authSlice.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
import { RootState } from '../../app/store';
import { revokeToken } from '../../common/api/authService';
import { Me } from '../../common/types/auth';
import { Me, MfaStatus } from '../../common/types/auth';

export interface TokenInfo {
created: number;
Expand All @@ -11,7 +11,7 @@ export interface TokenInfo {
type: string;
user: string;
cachefor: number;
mfa: 'USED' | 'NOT_USED' | 'UNKNOWN';
mfa: MfaStatus;
}

interface AuthState {
Expand Down