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
2 changed files with 69 additions and 35 deletions
|
@ -8,6 +8,27 @@ import { StaticContext } from 'react-router';
|
|||
import FlashMessageRender from '@/components/FlashMessageRender';
|
||||
import { ApplicationStore } from '@/state';
|
||||
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 }>) => {
|
||||
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'}>
|
||||
Device Checkpoint
|
||||
</h2>
|
||||
<Container>
|
||||
<FlashMessageRender/>
|
||||
<LoginFormContainer onSubmit={submit}>
|
||||
<div className={'mt-6'}>
|
||||
|
@ -87,6 +109,7 @@ export default ({ history, location: { state } }: RouteComponentProps<{}, Static
|
|||
</Link>
|
||||
</div>
|
||||
</LoginFormContainer>
|
||||
</Container>
|
||||
</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/2230
|
||||
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 ]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue