mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 22:14:58 +08:00
Merge pull request #4043 from matrix-org/bwindels/showunverifieddevicedialogonclick
Verify single device from other user in right panel & Not Trusted dialog
This commit is contained in:
commit
7a026eb15d
@ -31,6 +31,7 @@ export default createReactClass({
|
|||||||
danger: PropTypes.bool,
|
danger: PropTypes.bool,
|
||||||
focus: PropTypes.bool,
|
focus: PropTypes.bool,
|
||||||
onFinished: PropTypes.func.isRequired,
|
onFinished: PropTypes.func.isRequired,
|
||||||
|
headerImage: PropTypes.string,
|
||||||
},
|
},
|
||||||
|
|
||||||
getDefaultProps: function() {
|
getDefaultProps: function() {
|
||||||
@ -63,6 +64,7 @@ export default createReactClass({
|
|||||||
<BaseDialog className="mx_QuestionDialog" onFinished={this.props.onFinished}
|
<BaseDialog className="mx_QuestionDialog" onFinished={this.props.onFinished}
|
||||||
title={this.props.title}
|
title={this.props.title}
|
||||||
contentId='mx_Dialog_content'
|
contentId='mx_Dialog_content'
|
||||||
|
headerImage={this.props.headerImage}
|
||||||
hasCancel={this.props.hasCancelButton}
|
hasCancel={this.props.hasCancelButton}
|
||||||
>
|
>
|
||||||
<div className="mx_Dialog_content" id='mx_Dialog_content'>
|
<div className="mx_Dialog_content" id='mx_Dialog_content'>
|
||||||
|
@ -42,6 +42,8 @@ import {textualPowerLevel} from '../../../Roles';
|
|||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
import {RIGHT_PANEL_PHASES} from "../../../stores/RightPanelStorePhases";
|
import {RIGHT_PANEL_PHASES} from "../../../stores/RightPanelStorePhases";
|
||||||
import EncryptionPanel from "./EncryptionPanel";
|
import EncryptionPanel from "./EncryptionPanel";
|
||||||
|
import {verificationMethods} from 'matrix-js-sdk/src/crypto';
|
||||||
|
import {SCAN_QR_CODE_METHOD, SHOW_QR_CODE_METHOD} from "matrix-js-sdk/src/crypto/verification/QRCode";
|
||||||
|
|
||||||
const _disambiguateDevices = (devices) => {
|
const _disambiguateDevices = (devices) => {
|
||||||
const names = Object.create(null);
|
const names = Object.create(null);
|
||||||
@ -135,12 +137,43 @@ function useIsEncrypted(cli, room) {
|
|||||||
return isEncrypted;
|
return isEncrypted;
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyDevice(userId, device) {
|
async function verifyDevice(userId, device) {
|
||||||
const DeviceVerifyDialog = sdk.getComponent('views.dialogs.DeviceVerifyDialog');
|
const cli = MatrixClientPeg.get();
|
||||||
Modal.createTrackedDialog('Device Verify Dialog', '', DeviceVerifyDialog, {
|
const member = cli.getUser(userId);
|
||||||
userId: userId,
|
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
|
||||||
device: device,
|
Modal.createTrackedDialog("Verification warning", "unverified session", QuestionDialog, {
|
||||||
}, null, /* priority = */ false, /* static = */ true);
|
headerImage: require("../../../../res/img/e2e/warning.svg"),
|
||||||
|
title: _t("Not Trusted"),
|
||||||
|
description: <div>
|
||||||
|
<p>{_t("%(name)s (%(userId)s) signed in to a new session without verifying it:", {name: member.displayName, userId})}</p>
|
||||||
|
<p>{device.getDisplayName()} ({device.deviceId})</p>
|
||||||
|
<p>{_t("Ask this user to verify their session, or manually verify it below.")}</p>
|
||||||
|
</div>,
|
||||||
|
onFinished: async (doneClicked) => {
|
||||||
|
const manuallyVerifyClicked = !doneClicked;
|
||||||
|
if (!manuallyVerifyClicked) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const cli = MatrixClientPeg.get();
|
||||||
|
const verificationRequest = await cli.requestVerification(
|
||||||
|
userId,
|
||||||
|
[
|
||||||
|
verificationMethods.SAS,
|
||||||
|
SHOW_QR_CODE_METHOD,
|
||||||
|
SCAN_QR_CODE_METHOD,
|
||||||
|
verificationMethods.RECIPROCATE_QR_CODE,
|
||||||
|
],
|
||||||
|
[device.deviceId],
|
||||||
|
);
|
||||||
|
dis.dispatch({
|
||||||
|
action: "set_right_panel_phase",
|
||||||
|
phase: RIGHT_PANEL_PHASES.EncryptionPanel,
|
||||||
|
refireParams: {member, verificationRequest},
|
||||||
|
});
|
||||||
|
},
|
||||||
|
primaryButton: _t("Done"),
|
||||||
|
cancelButton: _t("Manually Verify"),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function verifyUser(user) {
|
function verifyUser(user) {
|
||||||
|
@ -1173,6 +1173,11 @@
|
|||||||
"Yours, or the other users’ session": "Yours, or the other users’ session",
|
"Yours, or the other users’ session": "Yours, or the other users’ session",
|
||||||
"Members": "Members",
|
"Members": "Members",
|
||||||
"Files": "Files",
|
"Files": "Files",
|
||||||
|
"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:",
|
||||||
|
"Ask this user to verify their session, or manually verify it below.": "Ask this user to verify their session, or manually verify it below.",
|
||||||
|
"Done": "Done",
|
||||||
|
"Manually Verify": "Manually Verify",
|
||||||
"Trusted": "Trusted",
|
"Trusted": "Trusted",
|
||||||
"Not trusted": "Not trusted",
|
"Not trusted": "Not trusted",
|
||||||
"%(count)s verified sessions|other": "%(count)s verified sessions",
|
"%(count)s verified sessions|other": "%(count)s verified sessions",
|
||||||
@ -1938,7 +1943,6 @@
|
|||||||
"Session verified": "Session verified",
|
"Session verified": "Session verified",
|
||||||
"Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.": "Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.",
|
"Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.": "Your new session is now verified. It has access to your encrypted messages, and other users will see it as trusted.",
|
||||||
"Your new session is now verified. Other users will see it as trusted.": "Your new session is now verified. Other users will see it as trusted.",
|
"Your new session is now verified. Other users will see it as trusted.": "Your new session is now verified. Other users will see it as trusted.",
|
||||||
"Done": "Done",
|
|
||||||
"Without completing security on this session, it won’t have access to encrypted messages.": "Without completing security on this session, it won’t have access to encrypted messages.",
|
"Without completing security on this session, it won’t have access to encrypted messages.": "Without completing security on this session, it won’t have access to encrypted messages.",
|
||||||
"Go Back": "Go Back",
|
"Go Back": "Go Back",
|
||||||
"Failed to send email": "Failed to send email",
|
"Failed to send email": "Failed to send email",
|
||||||
|
Loading…
Reference in New Issue
Block a user