Show devices without encryption support separately from unverified session (#499)

* Show devices without encryption support separately

* Fix typo

* Don't show sessions without encryption support in red
This commit is contained in:
ginnyTheCat 2022-04-24 18:29:50 +02:00 committed by GitHub
parent b7c5902f67
commit 3da9b70632
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 5 deletions

View file

@ -92,7 +92,7 @@ function ProfileAvatarMenu() {
function CrossSigninAlert() {
const deviceList = useDeviceList();
const unverified = deviceList?.filter((device) => !isCrossVerified(device.device_id));
const unverified = deviceList?.filter((device) => isCrossVerified(device.device_id) === false);
if (!unverified?.length) return null;

View file

@ -124,9 +124,16 @@ function DeviceManage() {
const unverified = [];
const verified = [];
const noEncryption = [];
deviceList.sort((a, b) => b.last_seen_ts - a.last_seen_ts).forEach((device) => {
if (isCrossVerified(device.device_id)) verified.push(device);
else unverified.push(device);
const isVerified = isCrossVerified(device.device_id);
if (isVerified === true) {
verified.push(device);
} else if (isVerified === false) {
unverified.push(device);
} else {
noEncryption.push(device);
}
});
return (
<div className="device-manage">
@ -145,9 +152,15 @@ function DeviceManage() {
{
unverified.length > 0
? unverified.map((device) => renderDevice(device, false))
: <Text className="device-manage__info">No unverified session</Text>
: <Text className="device-manage__info">No unverified sessions</Text>
}
</div>
{noEncryption.length > 0 && (
<div>
<MenuHeader>Sessions without encryption support</MenuHeader>
{noEncryption.map((device) => renderDevice(device, true))}
</div>
)}
<div>
<MenuHeader>Verified sessions</MenuHeader>
{

View file

@ -171,7 +171,8 @@ export function isCrossVerified(deviceId) {
const deviceTrust = crossSignInfo.checkDeviceTrust(crossSignInfo, deviceInfo, false, true);
return deviceTrust.isCrossSigningVerified();
} catch {
return false;
// device does not support encryption
return null;
}
}