// Hooks import { useState } from 'react' import { useTranslation } from 'next-i18next' import { useBackend } from 'site/hooks/useBackend.mjs' import { useToast } from 'site/hooks/useToast.mjs' // Verification methods import { validateEmail, validateTld } from 'site/utils.mjs' // Components import Link from 'next/link' import Markdown from 'react-markdown' import { Icons, welcomeSteps, BackToAccountButton } from './shared.mjs' import { Popout } from 'shared/components/popout.mjs' import { PageLink } from 'shared/components/page-link.mjs' export const ns = ['account'] const Tab = ({ id, activeTab, setActiveTab, t }) => ( ) export const EmailSettings = ({ app, title = false }) => { const backend = useBackend(app) const { t } = useTranslation(ns) const toast = useToast() const [email, setEmail] = useState(app.account.email) const [sent, setSent] = useState(false) const save = async () => { const result = await backend.updateAccount({ email }) if (result) toast.for.settingsSaved() else toast.for.backendError() } const valid = (validateEmail(email) && validateTld(email)) || false return ( <> {title ?
When you change your email address here, we will sent a confirmation email to the new email address.