// Dependencies import { useState, useContext } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' import { useBackend } from 'shared/hooks/use-backend.mjs' import { useToast } from 'shared/hooks/use-toast.mjs' // Context import { LoadingContext } from 'shared/context/loading-context.mjs' // Components import Link from 'next/link' import { BackToAccountButton } from './shared.mjs' import { SaveSettingsButton } from 'shared/components/buttons/save-settings-button.mjs' import { Popout } from 'shared/components/popout.mjs' import { RightIcon } from 'shared/components/icons.mjs' export const ns = ['account', 'toast'] export const PasswordSettings = ({ title = false, welcome = false }) => { // Context const { loading, startLoading, stopLoading } = useContext(LoadingContext) // Hooks const { account, setAccount, token } = useAccount() const backend = useBackend(token) const { t } = useTranslation(ns) const toast = useToast() // State const [password, setPassword] = useState('') const [reveal, setReveal] = useState(false) // Helper method to save password to account const save = async () => { startLoading() const result = await backend.updateAccount({ password }) if (result.success) { setAccount(result.data.account) toast.for.settingsSaved() } else toast.for.backendError() stopLoading() } return (
{t('mfaTipMsg')}
{t('mfa')}