// Context import { LoadingStatusContext } from '@freesewing/react/context/LoadingStatus' // Hooks import React, { useState, useContext } from 'react' import { useAccount } from '@freesewing/react/hooks/useAccount' import { useBackend } from '@freesewing/react/hooks/useBackend' // Components import { Link as WebLink } from '@freesewing/react/components/Link' import { RightIcon, SaveIcon } from '@freesewing/react/components/Icon' import { PasswordInput } from '@freesewing/react/components/Input' import { Popout } from '@freesewing/react/components/Popout' /** * A component to manage the user's password * * @component * @param {object} props - All component props * @param {bool} [props.welcome = false] - Set to true to render the welcome/onboarding view * @param {React.Component} props.Link - A framework specific Link component for client-side routing * @returns {JSX.Element} */ export const Password = ({ Link = false }) => { if (!Link) Link = WebLink // Hooks const backend = useBackend() const { account, setAccount } = useAccount() const { setLoadingStatus } = useContext(LoadingStatusContext) // State const [password, setPassword] = useState('') // Helper method to save password to account const save = async () => { setLoadingStatus([true, 'Updating password']) const [status, body] = await backend.updateAccount({ password }) if (status === 200 && body.result === 'success') { setAccount(body.account) setLoadingStatus([true, 'Password updated', true, true]) } else setLoadingStatus([true, 'Something went wrong. Please report this', true, true]) } return (
We do not enforce a password policy, but we do recommend you enable Two-Factor Authentication to keep your FreeSewing account safe.
Two-Factor Authentication