Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3383564
D12454.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12454.diff
View Options
diff --git a/lib/components/qr-auth-provider.react.js b/lib/components/qr-auth-provider.react.js
--- a/lib/components/qr-auth-provider.react.js
+++ b/lib/components/qr-auth-provider.react.js
@@ -63,6 +63,7 @@
const [primaryDeviceID, setPrimaryDeviceID] = React.useState<?string>();
const [qrData, setQRData] = React.useState<?QRData>();
+ const [qrAuthFinished, setQRAuthFinished] = React.useState(false);
const {
setUnauthorizedDeviceID,
@@ -85,6 +86,7 @@
setUnauthorizedDeviceID(ed25519);
setQRData({ deviceID: ed25519, aesKey: aesKeyAsHexString });
+ setQRAuthFinished(false);
} catch (err) {
console.error('Failed to generate QR Code:', err);
}
@@ -104,7 +106,12 @@
);
React.useEffect(() => {
- if (!qrData || !socketState.isAuthorized || !primaryDeviceID) {
+ if (
+ !qrData ||
+ !socketState.isAuthorized ||
+ !primaryDeviceID ||
+ qrAuthFinished
+ ) {
return;
}
@@ -124,6 +131,7 @@
qrData,
socketState,
composeTunnelbrokerMessage,
+ qrAuthFinished,
]);
const tunnelbrokerMessageListener = React.useCallback(
@@ -171,6 +179,7 @@
backupDataKey,
backupLogDataKey,
});
+ setQRAuthFinished(true);
return;
}
@@ -199,7 +208,7 @@
);
React.useEffect(() => {
- if (!qrData?.deviceID) {
+ if (!qrData?.deviceID || qrAuthFinished) {
return undefined;
}
@@ -212,6 +221,7 @@
removeListener,
tunnelbrokerMessageListener,
qrData?.deviceID,
+ qrAuthFinished,
]);
const value = React.useMemo(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Nov 29, 4:41 PM (20 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2597496
Default Alt Text
D12454.diff (1 KB)
Attached To
Mode
D12454: [lib] avoid listening to Tunnelbroker messages in `QRAuthProvider` when QR auth is finished
Attached
Detach File
Event Timeline
Log In to Comment