diff --git a/ui/password-generator-tool/src/components/Generate.jsx b/ui/password-generator-tool/src/components/Generate.jsx index 8bff4fa..74c3dec 100644 --- a/ui/password-generator-tool/src/components/Generate.jsx +++ b/ui/password-generator-tool/src/components/Generate.jsx @@ -10,12 +10,28 @@ const Generate = () => { const [number, setNumber] = useState(false) const [specialCharacter, setSpecialCharacter] = useState(false) const [passwordLength, setPasswordLength] = useState(8) - const [generatedPassword, setGeneratedPassword] = useState('eKs@4]sx3hq]') + const [generatedPassword, setGeneratedPassword] = useState('Configure your password') const [sendToEmail, setSendToEmail] = useState(false) const [targetEmail, setTargetEmail] = useState('') + const [copy, setCopied] = useState('COPY') + const [settings, setSettings] = useState(0) useEffect(() => { const characters = { capitalAlphabet, smallAlphabet, number, specialCharacter, passwordLength } + var count = 0 + if (characters.capitalAlphabet) { + count += 1 + } + if (characters.smallAlphabet) { + count += 1 + } + if (characters.number) { + count += 1 + } + if (characters.specialCharacter) { + count += 1 + } + setSettings(count) callGeneratePasswordApi(characters) }, [capitalAlphabet, smallAlphabet, number, specialCharacter, passwordLength]) @@ -40,16 +56,30 @@ const Generate = () => {