report IP of self-verification reqs
parent
5b48e13eb9
commit
aa0cca9306
|
@ -38,6 +38,7 @@ interface IProps {
|
|||
interface IState {
|
||||
counter: number;
|
||||
device?: DeviceInfo;
|
||||
IP?: string;
|
||||
}
|
||||
|
||||
export default class VerificationRequestToast extends React.PureComponent<IProps, IState> {
|
||||
|
@ -66,9 +67,15 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
|
|||
// a toast hanging around after logging in if you did a verification as part of login).
|
||||
this._checkRequestIsPending();
|
||||
|
||||
|
||||
if (request.isSelfVerification) {
|
||||
const cli = MatrixClientPeg.get();
|
||||
this.setState({device: cli.getStoredDevice(cli.getUserId(), request.channel.deviceId)});
|
||||
const device = await cli.getDevice(request.channel.deviceId);
|
||||
const IP = device.last_seen_ip;
|
||||
this.setState({
|
||||
device: cli.getStoredDevice(cli.getUserId(), request.channel.deviceId),
|
||||
IP,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -118,6 +125,9 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
|
|||
const VerificationRequestDialog = sdk.getComponent("views.dialogs.VerificationRequestDialog");
|
||||
Modal.createTrackedDialog('Incoming Verification', '', VerificationRequestDialog, {
|
||||
verificationRequest: request,
|
||||
onFinished: () => {
|
||||
request.cancel();
|
||||
},
|
||||
}, null, /* priority = */ false, /* static = */ true);
|
||||
}
|
||||
await request.accept();
|
||||
|
@ -131,9 +141,10 @@ export default class VerificationRequestToast extends React.PureComponent<IProps
|
|||
let nameLabel;
|
||||
if (request.isSelfVerification) {
|
||||
if (this.state.device) {
|
||||
nameLabel = _t("From %(deviceName)s (%(deviceId)s)", {
|
||||
nameLabel = _t("From %(deviceName)s (%(deviceId)s) from %(IP)s", {
|
||||
deviceName: this.state.device.getDisplayName(),
|
||||
deviceId: this.state.device.deviceId,
|
||||
IP: this.state.IP,
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue