mirror of https://github.com/vector-im/riot-web
Add "legacy verify" button to untrusted session dialog
parent
510b71b0e5
commit
073c2c525f
|
@ -294,8 +294,9 @@
|
||||||
"Not Trusted": "Not Trusted",
|
"Not Trusted": "Not Trusted",
|
||||||
"%(name)s (%(userId)s) signed in to a new session without verifying it:": "%(name)s (%(userId)s) signed in to a new session without verifying it:",
|
"%(name)s (%(userId)s) signed in to a new session without verifying it:": "%(name)s (%(userId)s) signed in to a new session without verifying it:",
|
||||||
"Ask this user to verify their session, or manually verify it below.": "Ask this user to verify their session, or manually verify it below.",
|
"Ask this user to verify their session, or manually verify it below.": "Ask this user to verify their session, or manually verify it below.",
|
||||||
|
"Legacy Verify Device": "Legacy Verify Device",
|
||||||
|
"Verify Device by Emoji": "Verify Device by Emoji",
|
||||||
"Done": "Done",
|
"Done": "Done",
|
||||||
"Manually Verify": "Manually Verify",
|
|
||||||
"%(displayName)s is typing …": "%(displayName)s is typing …",
|
"%(displayName)s is typing …": "%(displayName)s is typing …",
|
||||||
"%(names)s and %(count)s others are typing …|other": "%(names)s and %(count)s others are typing …",
|
"%(names)s and %(count)s others are typing …|other": "%(names)s and %(count)s others are typing …",
|
||||||
"%(names)s and %(count)s others are typing …|one": "%(names)s and one other is typing …",
|
"%(names)s and %(count)s others are typing …|one": "%(names)s and one other is typing …",
|
||||||
|
|
|
@ -39,38 +39,55 @@ async function enable4SIfNeeded() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function UntrustedDeviceDialog(props) {
|
||||||
|
const {device, user, onFinished} = props;
|
||||||
|
const BaseDialog = sdk.getComponent("dialogs.BaseDialog");
|
||||||
|
const AccessibleButton = sdk.getComponent("elements.AccessibleButton");
|
||||||
|
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>{_t("%(name)s (%(userId)s) signed in to a new session without verifying it:", {name: user.displayName, userId: user.userId})}</p>
|
||||||
|
<p>{device.getDisplayName()} ({device.deviceId})</p>
|
||||||
|
<p>{_t("Ask this user to verify their session, or manually verify it below.")}</p>
|
||||||
|
</div>
|
||||||
|
<div className='mx_Dialog_buttons'>
|
||||||
|
<AccessibleButton element="button" kind="secondary" onClick={() => onFinished("legacy")}>{_t("Legacy Verify Device")}</AccessibleButton>
|
||||||
|
<AccessibleButton element="button" kind="secondary" onClick={() => onFinished("sas")}>{_t("Verify Device by Emoji")}</AccessibleButton>
|
||||||
|
<AccessibleButton kind="primary" onClick={() => onFinished()}>{_t("Done")}</AccessibleButton>
|
||||||
|
</div>
|
||||||
|
</BaseDialog>;
|
||||||
|
}
|
||||||
|
|
||||||
export async function verifyDevice(user, device) {
|
export async function verifyDevice(user, device) {
|
||||||
if (!await enable4SIfNeeded()) {
|
if (!await enable4SIfNeeded()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
Modal.createTrackedDialog("Verification warning", "unverified session", UntrustedDeviceDialog, {
|
||||||
Modal.createTrackedDialog("Verification warning", "unverified session", QuestionDialog, {
|
user,
|
||||||
headerImage: require("../res/img/e2e/warning.svg"),
|
device,
|
||||||
title: _t("Not Trusted"),
|
onFinished: async (action) => {
|
||||||
description: <div>
|
if (action === "sas") {
|
||||||
<p>{_t("%(name)s (%(userId)s) signed in to a new session without verifying it:", {name: user.displayName, userId: user.userId})}</p>
|
const cli = MatrixClientPeg.get();
|
||||||
<p>{device.getDisplayName()} ({device.deviceId})</p>
|
const verificationRequestPromise = cli.legacyDeviceVerification(
|
||||||
<p>{_t("Ask this user to verify their session, or manually verify it below.")}</p>
|
user.userId,
|
||||||
</div>,
|
device.deviceId,
|
||||||
onFinished: async (doneClicked) => {
|
verificationMethods.SAS,
|
||||||
const manuallyVerifyClicked = !doneClicked;
|
);
|
||||||
if (!manuallyVerifyClicked) {
|
dis.dispatch({
|
||||||
return;
|
action: "set_right_panel_phase",
|
||||||
|
phase: RIGHT_PANEL_PHASES.EncryptionPanel,
|
||||||
|
refireParams: {member: user, verificationRequestPromise},
|
||||||
|
});
|
||||||
|
} else if (action === "legacy") {
|
||||||
|
const ManualDeviceKeyVerificationDialog = sdk.getComponent("dialogs.ManualDeviceKeyVerificationDialog");
|
||||||
|
Modal.createTrackedDialog("Legacy verify session", "legacy verify session", ManualDeviceKeyVerificationDialog, {
|
||||||
|
userId: user.userId,
|
||||||
|
device,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const cli = MatrixClientPeg.get();
|
|
||||||
const verificationRequestPromise = cli.legacyDeviceVerification(
|
|
||||||
user.userId,
|
|
||||||
device.deviceId,
|
|
||||||
verificationMethods.SAS,
|
|
||||||
);
|
|
||||||
dis.dispatch({
|
|
||||||
action: "set_right_panel_phase",
|
|
||||||
phase: RIGHT_PANEL_PHASES.EncryptionPanel,
|
|
||||||
refireParams: {member: user, verificationRequestPromise},
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
primaryButton: _t("Done"),
|
|
||||||
cancelButton: _t("Manually Verify"),
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue