about summary refs log tree commit diff
path: root/src/view/screens/Settings/Email2FAToggle.tsx
diff options
context:
space:
mode:
authorSamuel Newman <mozzius@protonmail.com>2024-11-08 22:42:18 +0000
committerGitHub <noreply@github.com>2024-11-08 22:42:18 +0000
commit5da3f29498fda9ab1181df19a718e37099cb2cf6 (patch)
tree4989300fe333edc3ad1c12c7b0d03e6ff5112ee3 /src/view/screens/Settings/Email2FAToggle.tsx
parente8a03058bb993bda993e78d24877884d39666d63 (diff)
downloadvoidsky-5da3f29498fda9ab1181df19a718e37099cb2cf6.tar.zst
[Settings] Ungate, and remove old settings (#6144)
* move export car dialog

* move disableemail2fadialog

* delete old settings screens

* fix type error

* Update Navigation.tsx

* Delete AccountDropdownBtn.tsx

* remove old change handle modal

* delete add app paswords

* forgot to actually delete the change handle modal
Diffstat (limited to 'src/view/screens/Settings/Email2FAToggle.tsx')
-rw-r--r--src/view/screens/Settings/Email2FAToggle.tsx58
1 files changed, 0 insertions, 58 deletions
diff --git a/src/view/screens/Settings/Email2FAToggle.tsx b/src/view/screens/Settings/Email2FAToggle.tsx
deleted file mode 100644
index f6ed19a21..000000000
--- a/src/view/screens/Settings/Email2FAToggle.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import React from 'react'
-import {msg} from '@lingui/macro'
-import {useLingui} from '@lingui/react'
-
-import {useModalControls} from '#/state/modals'
-import {useAgent, useSession} from '#/state/session'
-import {ToggleButton} from '#/view/com/util/forms/ToggleButton'
-import {useDialogControl} from '#/components/Dialog'
-import {DisableEmail2FADialog} from './DisableEmail2FADialog'
-
-export function Email2FAToggle() {
-  const {_} = useLingui()
-  const {currentAccount} = useSession()
-  const {openModal} = useModalControls()
-  const disableDialogCtrl = useDialogControl()
-  const agent = useAgent()
-
-  const enableEmailAuthFactor = React.useCallback(async () => {
-    if (currentAccount?.email) {
-      await agent.com.atproto.server.updateEmail({
-        email: currentAccount.email,
-        emailAuthFactor: true,
-      })
-      await agent.resumeSession(agent.session!)
-    }
-  }, [currentAccount, agent])
-
-  const onToggle = React.useCallback(() => {
-    if (!currentAccount) {
-      return
-    }
-    if (currentAccount.emailAuthFactor) {
-      disableDialogCtrl.open()
-    } else {
-      if (!currentAccount.emailConfirmed) {
-        openModal({
-          name: 'verify-email',
-          onSuccess: enableEmailAuthFactor,
-        })
-        return
-      }
-      enableEmailAuthFactor()
-    }
-  }, [currentAccount, enableEmailAuthFactor, openModal, disableDialogCtrl])
-
-  return (
-    <>
-      <DisableEmail2FADialog control={disableDialogCtrl} />
-      <ToggleButton
-        type="default-light"
-        label={_(msg`Require email code to log into your account`)}
-        labelType="lg"
-        isSelected={!!currentAccount?.emailAuthFactor}
-        onPress={onToggle}
-      />
-    </>
-  )
-}