Always allow setting a password
Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
@@ -26,12 +26,12 @@ export const getRoomSharedKeyLocalStorageKey = (roomId: string): string =>
|
|||||||
|
|
||||||
export const useInternalRoomSharedKey = (
|
export const useInternalRoomSharedKey = (
|
||||||
roomId: string
|
roomId: string
|
||||||
): [string | null, ((value: string) => void) | null] => {
|
): [string | null, (value: string) => void] => {
|
||||||
const key = useMemo(() => getRoomSharedKeyLocalStorageKey(roomId), [roomId]);
|
const key = useMemo(() => getRoomSharedKeyLocalStorageKey(roomId), [roomId]);
|
||||||
const [e2eeEnabled] = useEnableE2EE();
|
const [e2eeEnabled] = useEnableE2EE();
|
||||||
const [roomSharedKey, setRoomSharedKey] = useLocalStorage(key);
|
const [roomSharedKey, setRoomSharedKey] = useLocalStorage(key);
|
||||||
|
|
||||||
return e2eeEnabled ? [roomSharedKey, setRoomSharedKey] : [null, null];
|
return [e2eeEnabled ? roomSharedKey : null, setRoomSharedKey];
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useRoomSharedKey = (roomId: string): string | null => {
|
export const useRoomSharedKey = (roomId: string): string | null => {
|
||||||
@@ -47,7 +47,7 @@ export const useManageRoomSharedKey = (roomId: string): string | null => {
|
|||||||
if (password === "") return;
|
if (password === "") return;
|
||||||
if (password === e2eeSharedKey) return;
|
if (password === e2eeSharedKey) return;
|
||||||
|
|
||||||
setE2EESharedKey?.(password);
|
setE2EESharedKey(password);
|
||||||
}, [password, e2eeSharedKey, setE2EESharedKey]);
|
}, [password, e2eeSharedKey, setE2EESharedKey]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user