Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F33262931
D14376.1768609440.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D14376.1768609440.diff
View Options
diff --git a/lib/components/secondary-device-qr-auth-context-provider.react.js b/lib/components/secondary-device-qr-auth-context-provider.react.js
--- a/lib/components/secondary-device-qr-auth-context-provider.react.js
+++ b/lib/components/secondary-device-qr-auth-context-provider.react.js
@@ -50,6 +50,7 @@
+qrData: QRData,
+openSecondaryQRAuth: () => Promise<void>,
+closeSecondaryQRAuth: () => void,
+ +canGenerateQRs: boolean,
};
const SecondaryDeviceQRAuthContext: React.Context<?SecondaryDeviceQRAuthContextType> =
@@ -57,6 +58,7 @@
qrData: null,
openSecondaryQRAuth: async () => {},
closeSecondaryQRAuth: () => {},
+ canGenerateQRs: true,
});
function SecondaryDeviceQRAuthContextProvider(props: Props): React.Node {
@@ -240,8 +242,14 @@
qrData,
openSecondaryQRAuth,
closeSecondaryQRAuth,
+ canGenerateQRs: !socketState.isAuthorized,
}),
- [qrData, openSecondaryQRAuth, closeSecondaryQRAuth],
+ [
+ qrData,
+ openSecondaryQRAuth,
+ closeSecondaryQRAuth,
+ socketState.isAuthorized,
+ ],
);
return (
@@ -259,24 +267,27 @@
}
function useSecondaryDeviceQRAuthURL(): ?string {
- const { qrData, openSecondaryQRAuth, closeSecondaryQRAuth } =
+ const { qrData, openSecondaryQRAuth, closeSecondaryQRAuth, canGenerateQRs } =
useSecondaryDeviceQRAuthContext();
React.useEffect(() => {
- void openSecondaryQRAuth();
- return closeSecondaryQRAuth;
- }, [closeSecondaryQRAuth, openSecondaryQRAuth]);
+ if (canGenerateQRs) {
+ void openSecondaryQRAuth();
+ return closeSecondaryQRAuth;
+ }
+ return undefined;
+ }, [closeSecondaryQRAuth, canGenerateQRs, openSecondaryQRAuth]);
const { platform } = getConfig().platformDetails;
const qrCodeURL = React.useMemo(() => {
- if (!qrData) {
+ if (!qrData || !canGenerateQRs) {
return undefined;
}
const identityDeviceType = platformToIdentityDeviceType[platform];
return qrCodeLinkURL(qrData.aesKey, qrData.deviceID, identityDeviceType);
- }, [platform, qrData]);
+ }, [canGenerateQRs, platform, qrData]);
React.useEffect(() => {
if (qrCodeURL) {
diff --git a/native/account/qr-code-screen.react.js b/native/account/qr-code-screen.react.js
--- a/native/account/qr-code-screen.react.js
+++ b/native/account/qr-code-screen.react.js
@@ -26,25 +26,28 @@
};
function QRCodeScreen(props: QRCodeScreenProps): React.Node {
- const { qrData, openSecondaryQRAuth, closeSecondaryQRAuth } =
+ const { qrData, openSecondaryQRAuth, closeSecondaryQRAuth, canGenerateQRs } =
useSecondaryDeviceQRAuthContext();
useFocusEffect(
React.useCallback(() => {
- void openSecondaryQRAuth();
- return closeSecondaryQRAuth;
- }, [closeSecondaryQRAuth, openSecondaryQRAuth]),
+ if (canGenerateQRs) {
+ void openSecondaryQRAuth();
+ return closeSecondaryQRAuth;
+ }
+ return undefined;
+ }, [canGenerateQRs, closeSecondaryQRAuth, openSecondaryQRAuth]),
);
const { platform } = getConfig().platformDetails;
const qrCodeURL = React.useMemo(() => {
- if (!qrData) {
+ if (!qrData || !canGenerateQRs) {
return undefined;
}
const deviceType = platformToIdentityDeviceType[platform];
return qrCodeLinkURL(qrData.aesKey, qrData.deviceID, deviceType);
- }, [platform, qrData]);
+ }, [canGenerateQRs, platform, qrData]);
const styles = useStyles(unboundStyles);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Jan 17, 12:24 AM (19 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5946549
Default Alt Text
D14376.1768609440.diff (3 KB)
Attached To
Mode
D14376: [web][native] Create an unauthenticated Tunnelbroker connection only when socket connection becomes unauthorized
Attached
Detach File
Event Timeline
Log In to Comment