Extract UntrustedDeviceDialog and fix e2ee icon
This commit is contained in:
parent
5d02e44293
commit
565e41c3df
4 changed files with 89 additions and 34 deletions
|
@ -18,12 +18,12 @@ import {MatrixClientPeg} from './MatrixClientPeg';
|
|||
import dis from "./dispatcher/dispatcher";
|
||||
import Modal from './Modal';
|
||||
import * as sdk from './index';
|
||||
import { _t } from './languageHandler';
|
||||
import {RightPanelPhases} from "./stores/RightPanelStorePhases";
|
||||
import {findDMForUser} from './createRoom';
|
||||
import {accessSecretStorage} from './SecurityManager';
|
||||
import {verificationMethods} from 'matrix-js-sdk/src/crypto';
|
||||
import {Action} from './dispatcher/actions';
|
||||
import UntrustedDeviceDialog from "./components/views/dialogs/UntrustedDeviceDialog";
|
||||
|
||||
async function enable4SIfNeeded() {
|
||||
const cli = MatrixClientPeg.get();
|
||||
|
@ -39,39 +39,6 @@ async function enable4SIfNeeded() {
|
|||
return true;
|
||||
}
|
||||
|
||||
function UntrustedDeviceDialog(props) {
|
||||
const {device, user, onFinished} = props;
|
||||
const BaseDialog = sdk.getComponent("dialogs.BaseDialog");
|
||||
const AccessibleButton = sdk.getComponent("elements.AccessibleButton");
|
||||
let askToVerifyText;
|
||||
let newSessionText;
|
||||
|
||||
if (MatrixClientPeg.get().getUserId() === user.userId) {
|
||||
newSessionText = _t("You signed in to a new session without verifying it:");
|
||||
askToVerifyText = _t("Verify your other session using one of the options below.");
|
||||
} else {
|
||||
newSessionText = _t("%(name)s (%(userId)s) signed in to a new session without verifying it:",
|
||||
{name: user.displayName, userId: user.userId});
|
||||
askToVerifyText = _t("Ask this user to verify their session, or manually verify it below.");
|
||||
}
|
||||
|
||||
return <BaseDialog
|
||||
onFinished={onFinished}
|
||||
headerImage={require("../res/img/e2e/warning.svg")}
|
||||
title={_t("Not Trusted")}>
|
||||
<div className="mx_Dialog_content" id='mx_Dialog_content'>
|
||||
<p>{newSessionText}</p>
|
||||
<p>{device.getDisplayName()} ({device.deviceId})</p>
|
||||
<p>{askToVerifyText}</p>
|
||||
</div>
|
||||
<div className='mx_Dialog_buttons'>
|
||||
<AccessibleButton element="button" kind="secondary" onClick={() => onFinished("legacy")}>{_t("Manually Verify by Text")}</AccessibleButton>
|
||||
<AccessibleButton element="button" kind="secondary" onClick={() => onFinished("sas")}>{_t("Interactively verify by Emoji")}</AccessibleButton>
|
||||
<AccessibleButton kind="primary" onClick={() => onFinished()}>{_t("Done")}</AccessibleButton>
|
||||
</div>
|
||||
</BaseDialog>;
|
||||
}
|
||||
|
||||
export async function verifyDevice(user, device) {
|
||||
const cli = MatrixClientPeg.get();
|
||||
if (cli.isGuest()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue