// @flow import { useConnectModal } from '@rainbow-me/rainbowkit'; import classnames from 'classnames'; import { QRCodeSVG } from 'qrcode.react'; import * as React from 'react'; import { useWalletClient } from 'wagmi'; import ModalOverlay from 'lib/components/modal-overlay.react.js'; import { useModalContext } from 'lib/components/modal-provider.react.js'; import { useSecondaryDeviceQRAuthContext } from 'lib/components/secondary-device-qr-auth-context-provider.react.js'; import { qrCodeLinkURL } from 'lib/facts/links.js'; import stores from 'lib/facts/stores.js'; import { platformToIdentityDeviceType } from 'lib/types/identity-service-types.js'; import { getConfig } from 'lib/utils/config.js'; import { useDispatch } from 'lib/utils/redux-utils.js'; import { useIsRestoreFlowEnabled } from 'lib/utils/services-utils.js'; import HeaderSeparator from './header-separator.react.js'; import css from './log-in-form.css'; import SIWEButton from './siwe-button.react.js'; import SIWELoginForm from './siwe-login-form.react.js'; import TraditionalLoginForm from './traditional-login-form.react.js'; import Button from '../components/button.react.js'; import OrBreak from '../components/or-break.react.js'; import { updateNavInfoActionType } from '../redux/action-types.js'; function LegacyLoginForm() { const { openConnectModal } = useConnectModal(); const { data: signer } = useWalletClient(); const dispatch = useDispatch(); const onQRCodeLoginButtonClick = React.useCallback(() => { dispatch({ type: updateNavInfoActionType, payload: { loginMethod: 'qr-code', }, }); }, [dispatch]); const qrCodeLoginButton = React.useMemo( () => (
), [onQRCodeLoginButtonClick], ); const [siweAuthFlowSelected, setSIWEAuthFlowSelected] = React.useState(false); const onSIWEButtonClick = React.useCallback(() => { setSIWEAuthFlowSelected(true); openConnectModal && openConnectModal(); }, [openConnectModal]); const cancelSIWEAuthFlow = React.useCallback(() => { setSIWEAuthFlowSelected(false); }, []); if (siweAuthFlowSelected && signer) { return (
); } return (
{qrCodeLoginButton}
); } function LoginForm() { const { qrData, openSecondaryQRAuth, closeSecondaryQRAuth } = useSecondaryDeviceQRAuthContext(); React.useEffect(() => { void openSecondaryQRAuth(); return closeSecondaryQRAuth; }, [closeSecondaryQRAuth, openSecondaryQRAuth]); const { platform } = getConfig().platformDetails; const qrCodeURL = React.useMemo(() => { if (!qrData) { return undefined; } const identityDeviceType = platformToIdentityDeviceType[platform]; return qrCodeLinkURL(qrData.aesKey, qrData.deviceID, identityDeviceType); }, [platform, qrData]); const { pushModal, clearModals, popModal } = useModalContext(); React.useEffect(() => { return clearModals; }, [clearModals]); const openRecoveryModal = React.useCallback(() => { pushModal(
To access Comm on web, you must first install Comm on your phone and then restore your account.
Download the Comm app on the  App Store  or  Google Play Store .
, ); }, [popModal, pushModal]); const openOldLoginModal = React.useCallback(() => { pushModal(
We’ve replaced our login options on web with a QR code to improve account security.
In the old system, a malicious actor with access to Comm’s servers could insert a new device for any given user. They could then use that fake device to send messages that would appear to be coming from that user.
In the new system, all new devices must be signed by an existing device, which makes that sort of attack impossible.
As part of these changes, we now require registration to occur on a mobile device, since the user needs to have at least one device capable of scanning a QR code.
, ); }, [popModal, pushModal]); return (

Log in to Comm

Open the Comm app on your phone and scan the QR code below:
How to find the scanner:
  • Go to Profile
  • Select Linked devices
  • Click Add on the top right
); } function LoginFormWrapper(): React.Node { const usingRestoreFlow = useIsRestoreFlowEnabled(); if (!usingRestoreFlow) { return ; } return ; } export default LoginFormWrapper;