fix: Added alert for bad encryption key (#3998)

This commit is contained in:
Ishan Sharma 2021-09-25 02:04:56 +05:30 committed by GitHub
parent c86c176e10
commit e8b462cc31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -137,6 +137,10 @@ export const decryptAESGEM = async (
export const getCollaborationLinkData = (link: string) => { export const getCollaborationLinkData = (link: string) => {
const hash = new URL(link).hash; const hash = new URL(link).hash;
const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/); const match = hash.match(/^#room=([a-zA-Z0-9_-]+),([a-zA-Z0-9_-]+)$/);
if (match && match[2].length !== 22) {
window.alert(t("alerts.invalidEncryptionKey"));
return null;
}
return match ? { roomId: match[1], roomKey: match[2] } : null; return match ? { roomId: match[1], roomKey: match[2] } : null;
}; };

View File

@ -157,7 +157,8 @@
"imageDoesNotContainScene": "Importing images isn't supported at the moment.\n\nDid you want to import a scene? This image does not seem to contain any scene data. Have you enabled this during export?", "imageDoesNotContainScene": "Importing images isn't supported at the moment.\n\nDid you want to import a scene? This image does not seem to contain any scene data. Have you enabled this during export?",
"cannotRestoreFromImage": "Scene couldn't be restored from this image file", "cannotRestoreFromImage": "Scene couldn't be restored from this image file",
"invalidSceneUrl": "Couldn't import scene from the supplied URL. It's either malformed, or doesn't contain valid Excalidraw JSON data.", "invalidSceneUrl": "Couldn't import scene from the supplied URL. It's either malformed, or doesn't contain valid Excalidraw JSON data.",
"resetLibrary": "This will clear your library. Are you sure?" "resetLibrary": "This will clear your library. Are you sure?",
"invalidEncryptionKey": "Encryption key must be of 22 characters. Live collaboration is disabled."
}, },
"toolBar": { "toolBar": {
"selection": "Selection", "selection": "Selection",