dedicated dialog box for E2E messages
This commit is contained in:
parent
5a548c3d12
commit
9b7ab46a72
5 changed files with 35 additions and 70 deletions
|
@ -49,6 +49,7 @@ module.exports.components['views.create_room.Presets'] = require('./components/v
|
||||||
module.exports.components['views.create_room.RoomAlias'] = require('./components/views/create_room/RoomAlias');
|
module.exports.components['views.create_room.RoomAlias'] = require('./components/views/create_room/RoomAlias');
|
||||||
module.exports.components['views.dialogs.ChatInviteDialog'] = require('./components/views/dialogs/ChatInviteDialog');
|
module.exports.components['views.dialogs.ChatInviteDialog'] = require('./components/views/dialogs/ChatInviteDialog');
|
||||||
module.exports.components['views.dialogs.DeactivateAccountDialog'] = require('./components/views/dialogs/DeactivateAccountDialog');
|
module.exports.components['views.dialogs.DeactivateAccountDialog'] = require('./components/views/dialogs/DeactivateAccountDialog');
|
||||||
|
module.exports.components['views.dialogs.EncryptedEventDialog'] = require('./components/views/dialogs/EncryptedEventDialog');
|
||||||
module.exports.components['views.dialogs.ErrorDialog'] = require('./components/views/dialogs/ErrorDialog');
|
module.exports.components['views.dialogs.ErrorDialog'] = require('./components/views/dialogs/ErrorDialog');
|
||||||
module.exports.components['views.dialogs.LogoutPrompt'] = require('./components/views/dialogs/LogoutPrompt');
|
module.exports.components['views.dialogs.LogoutPrompt'] = require('./components/views/dialogs/LogoutPrompt');
|
||||||
module.exports.components['views.dialogs.MultiInviteDialog'] = require('./components/views/dialogs/MultiInviteDialog');
|
module.exports.components['views.dialogs.MultiInviteDialog'] = require('./components/views/dialogs/MultiInviteDialog');
|
||||||
|
|
|
@ -18,6 +18,11 @@ var dis = require("../../../dispatcher");
|
||||||
|
|
||||||
module.exports = React.createClass({
|
module.exports = React.createClass({
|
||||||
displayName: 'LogoutPrompt',
|
displayName: 'LogoutPrompt',
|
||||||
|
|
||||||
|
propTypes: {
|
||||||
|
onFinished: React.PropTypes.func,
|
||||||
|
},
|
||||||
|
|
||||||
logOut: function() {
|
logOut: function() {
|
||||||
dis.dispatch({action: 'logout'});
|
dis.dispatch({action: 'logout'});
|
||||||
if (this.props.onFinished) {
|
if (this.props.onFinished) {
|
||||||
|
|
|
@ -363,62 +363,11 @@ module.exports = React.createClass({
|
||||||
},
|
},
|
||||||
|
|
||||||
onCryptoClicked: function(e) {
|
onCryptoClicked: function(e) {
|
||||||
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
|
var EncryptedEventDialog = sdk.getComponent("dialogs.EncryptedEventDialog");
|
||||||
var event = this.props.mxEvent;
|
var event = this.props.mxEvent;
|
||||||
|
|
||||||
// XXX: gutwrench - is there any reason not to expose this on MatrixClient itself?
|
Modal.createDialog(EncryptedEventDialog, {
|
||||||
var device = MatrixClientPeg.get()._crypto.getDeviceByIdentityKey(
|
event: event,
|
||||||
event.getSender(),
|
|
||||||
event.getWireContent().algorithm,
|
|
||||||
event.getWireContent().sender_key
|
|
||||||
);
|
|
||||||
|
|
||||||
Modal.createDialog(ErrorDialog, {
|
|
||||||
title: "End-to-end encryption information",
|
|
||||||
description: (
|
|
||||||
<div>
|
|
||||||
<table>
|
|
||||||
<tbody>
|
|
||||||
<tr>
|
|
||||||
<td>Sent by</td>
|
|
||||||
<td>{ event.getSender() }</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Sender device name</td>
|
|
||||||
<td>{ device.getDisplayName() }</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Sender device ID</td>
|
|
||||||
<td>{ device.deviceId }</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Sender device verification:</td>
|
|
||||||
<td>{ MatrixClientPeg.get().isEventSenderVerified(event) ? "verified" : <b>NOT verified</b> }</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Sender device ed25519 fingerprint</td>
|
|
||||||
<td>{ device.getFingerprint() }</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Sender device curve25519 identity key</td>
|
|
||||||
<td>{ event.getWireContent().sender_key }</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Algorithm</td>
|
|
||||||
<td>{ event.getWireContent().algorithm }</td>
|
|
||||||
</tr>
|
|
||||||
{
|
|
||||||
event.getContent().msgtype === 'm.bad.encrypted' ? (
|
|
||||||
<tr>
|
|
||||||
<td>Decryption error</td>
|
|
||||||
<td>{ event.getContent().body }</td>
|
|
||||||
</tr>
|
|
||||||
) : ''
|
|
||||||
}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -54,33 +54,33 @@ export default class MemberDeviceInfo extends React.Component {
|
||||||
var indicator = null, blockButton = null, verifyButton = null;
|
var indicator = null, blockButton = null, verifyButton = null;
|
||||||
if (this.props.device.isBlocked()) {
|
if (this.props.device.isBlocked()) {
|
||||||
blockButton = (
|
blockButton = (
|
||||||
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unblock"
|
<button className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unblock"
|
||||||
onClick={this.onUnblockClick}>
|
onClick={this.onUnblockClick}>
|
||||||
Unblock
|
Unblock
|
||||||
</div>
|
</button>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
blockButton = (
|
blockButton = (
|
||||||
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_block"
|
<button className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_block"
|
||||||
onClick={this.onBlockClick}>
|
onClick={this.onBlockClick}>
|
||||||
Block
|
Block
|
||||||
</div>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.device.isVerified()) {
|
if (this.props.device.isVerified()) {
|
||||||
verifyButton = (
|
verifyButton = (
|
||||||
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unverify"
|
<button className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_unverify"
|
||||||
onClick={this.onUnverifyClick}>
|
onClick={this.onUnverifyClick}>
|
||||||
Unverify
|
Unverify
|
||||||
</div>
|
</button>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
verifyButton = (
|
verifyButton = (
|
||||||
<div className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_verify"
|
<button className="mx_MemberDeviceInfo_textButton mx_MemberDeviceInfo_verify"
|
||||||
onClick={this.onVerifyClick}>
|
onClick={this.onVerifyClick}>
|
||||||
Verify
|
Verify
|
||||||
</div>
|
</button>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,14 +101,23 @@ export default class MemberDeviceInfo extends React.Component {
|
||||||
|
|
||||||
var deviceName = this.props.device.getDisplayName() || this.props.device.deviceId;
|
var deviceName = this.props.device.getDisplayName() || this.props.device.deviceId;
|
||||||
|
|
||||||
// add the deviceId as a titletext to help with debugging
|
var info;
|
||||||
return (
|
if (!this.props.hideInfo) {
|
||||||
<div className="mx_MemberDeviceInfo" title={this.props.device.deviceId}>
|
info = (
|
||||||
|
<div>
|
||||||
<div className="mx_MemberDeviceInfo_deviceId">{deviceName}</div>
|
<div className="mx_MemberDeviceInfo_deviceId">{deviceName}</div>
|
||||||
{indicator}
|
{indicator}
|
||||||
<div className="mx_MemberDeviceInfo_deviceKey">
|
<div className="mx_MemberDeviceInfo_deviceKey">
|
||||||
{this.props.device.getFingerprint()}
|
{this.props.device.getFingerprint()}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// add the deviceId as a titletext to help with debugging
|
||||||
|
return (
|
||||||
|
<div className="mx_MemberDeviceInfo" title={this.props.device.deviceId}>
|
||||||
|
{ info }
|
||||||
{ verifyButton }
|
{ verifyButton }
|
||||||
{ blockButton }
|
{ blockButton }
|
||||||
</div>
|
</div>
|
||||||
|
@ -120,4 +129,5 @@ MemberDeviceInfo.displayName = 'MemberDeviceInfo';
|
||||||
MemberDeviceInfo.propTypes = {
|
MemberDeviceInfo.propTypes = {
|
||||||
userId: React.PropTypes.string.isRequired,
|
userId: React.PropTypes.string.isRequired,
|
||||||
device: React.PropTypes.object.isRequired,
|
device: React.PropTypes.object.isRequired,
|
||||||
|
hideInfo: React.PropTypes.bool,
|
||||||
};
|
};
|
||||||
|
|
|
@ -204,7 +204,7 @@ export default class MessageComposer extends React.Component {
|
||||||
if (MatrixClientPeg.get().isRoomEncrypted(this.props.room.roomId)) {
|
if (MatrixClientPeg.get().isRoomEncrypted(this.props.room.roomId)) {
|
||||||
// FIXME: show a /!\ if there are untrusted devices in the room...
|
// FIXME: show a /!\ if there are untrusted devices in the room...
|
||||||
controls.push(
|
controls.push(
|
||||||
<img className="mx_MessageComposer_e2eIcon" src="img/e2e-verified.svg" width="10" height="12" alt="Encrypted room"/>
|
<img key="e2eIcon" className="mx_MessageComposer_e2eIcon" src="img/e2e-verified.svg" width="10" height="12" alt="Encrypted room"/>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue