Fix 2FA sizing issue, add support for copying text from xterm.js (#1825)
closes #1812, closes #1813
This commit is contained in:
parent
1b1c95d8ce
commit
b05048871c
|
@ -8,6 +8,27 @@ import { StaticContext } from 'react-router';
|
||||||
import FlashMessageRender from '@/components/FlashMessageRender';
|
import FlashMessageRender from '@/components/FlashMessageRender';
|
||||||
import { ApplicationStore } from '@/state';
|
import { ApplicationStore } from '@/state';
|
||||||
import Spinner from '@/components/elements/Spinner';
|
import Spinner from '@/components/elements/Spinner';
|
||||||
|
import styled from 'styled-components';
|
||||||
|
import { breakpoint } from 'styled-components-breakpoint';
|
||||||
|
|
||||||
|
const Container = styled.div`
|
||||||
|
${breakpoint('sm')`
|
||||||
|
${tw`w-4/5 mx-auto`}
|
||||||
|
`};
|
||||||
|
|
||||||
|
${breakpoint('md')`
|
||||||
|
${tw`p-10`}
|
||||||
|
`};
|
||||||
|
|
||||||
|
${breakpoint('lg')`
|
||||||
|
${tw`w-3/5`}
|
||||||
|
`};
|
||||||
|
|
||||||
|
${breakpoint('xl')`
|
||||||
|
${tw`w-full`}
|
||||||
|
max-width: 660px;
|
||||||
|
`};
|
||||||
|
`;
|
||||||
|
|
||||||
export default ({ history, location: { state } }: RouteComponentProps<{}, StaticContext, { token?: string }>) => {
|
export default ({ history, location: { state } }: RouteComponentProps<{}, StaticContext, { token?: string }>) => {
|
||||||
const [ code, setCode ] = useState('');
|
const [ code, setCode ] = useState('');
|
||||||
|
@ -52,6 +73,7 @@ export default ({ history, location: { state } }: RouteComponentProps<{}, Static
|
||||||
<h2 className={'text-center text-neutral-100 font-medium py-4'}>
|
<h2 className={'text-center text-neutral-100 font-medium py-4'}>
|
||||||
Device Checkpoint
|
Device Checkpoint
|
||||||
</h2>
|
</h2>
|
||||||
|
<Container>
|
||||||
<FlashMessageRender/>
|
<FlashMessageRender/>
|
||||||
<LoginFormContainer onSubmit={submit}>
|
<LoginFormContainer onSubmit={submit}>
|
||||||
<div className={'mt-6'}>
|
<div className={'mt-6'}>
|
||||||
|
@ -87,6 +109,7 @@ export default ({ history, location: { state } }: RouteComponentProps<{}, Static
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</LoginFormContainer>
|
</LoginFormContainer>
|
||||||
|
</Container>
|
||||||
</React.Fragment>
|
</React.Fragment>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
|
@ -81,6 +81,17 @@ export default () => {
|
||||||
// @see https://github.com/xtermjs/xterm.js/issues/2265
|
// @see https://github.com/xtermjs/xterm.js/issues/2265
|
||||||
// @see https://github.com/xtermjs/xterm.js/issues/2230
|
// @see https://github.com/xtermjs/xterm.js/issues/2230
|
||||||
TerminalFit.fit(terminal);
|
TerminalFit.fit(terminal);
|
||||||
|
|
||||||
|
// Add support for copying terminal text.
|
||||||
|
terminal.attachCustomKeyEventHandler((e: KeyboardEvent) => {
|
||||||
|
// Ctrl + C
|
||||||
|
if (e.ctrlKey && (e.key === 'c')) {
|
||||||
|
document.execCommand('copy');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}, [ terminal, connected, terminalElement ]);
|
}, [ terminal, connected, terminalElement ]);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue