diff --git a/src/components/Manager.jsx b/src/components/Manager.jsx index 76068d9..bb15425 100755 --- a/src/components/Manager.jsx +++ b/src/components/Manager.jsx @@ -46,6 +46,27 @@ const Manager = () => { ? "icons/eye.png" : "icons/eyecross.png"; }; + + const generatePassword = () => { + const lowerCase = 'abcdefghijklmnopqrstuvwxyz'; + const upperCase = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + const numbers = '0123456789'; + const symbols = '!@#$%^&*()_+[]{}|;:,.<>?'; + + const allChars = lowerCase + upperCase + numbers + symbols; + let generatedPassword = ''; + + for (let i = 0; i < 12; i++) { + const randomChar = allChars[Math.floor(Math.random() * allChars.length)]; + generatedPassword += randomChar; + } + // Log the generated password + console.log(generatedPassword); + copyText(generatedPassword); + // Set the generated password into the form's password field + setForm((prevForm) => ({ ...prevForm, password: generatedPassword })); + }; + const savePassword = async () => { const passwordValidation = (password) => { @@ -202,6 +223,15 @@ const Manager = () => { + + {/* Add a button to generate a password */} + +