Skip to content

Commit 28338d0

Browse files
committed
deleted project2 file, addressed requested changes
1 parent 218f31f commit 28338d0

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

ReactPasswordGenerator/AnuragC07/src/App.jsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { useCallback, useEffect, useState, useRef } from 'react'
33

44
function App() {
55
const [length, setLength] = useState(8)
6-
const [numberAllowed, setNumberAllowed] = useState(false)
76
const [charAllowed, setCharAllowed] = useState(false)
7+
const [symbolAllowed, setSymbolAllowed] = useState(false)
88
const [password, setPassword] = useState("")
99
const passwordRef = useRef(null)
1010

1111
const passwordGenerator = useCallback(() => {
1212

1313
let pass = ""
14-
let str = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
15-
16-
if(numberAllowed) str += "0123456789"
17-
if(charAllowed) str += "!@#$%^&*()_+`~"
14+
let str = "0123456789"
15+
// "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
16+
if(charAllowed) str += "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
17+
if(symbolAllowed) str += "!@#$%^&*()_+`~"
1818

1919
for(let i = 1; i <= length; i++){
2020
let char = Math.floor(Math.random() * str.length + 1)
@@ -25,7 +25,7 @@ function App() {
2525

2626
setPassword(pass)
2727

28-
}, [length, numberAllowed, charAllowed, setPassword])
28+
}, [length, charAllowed, symbolAllowed, setPassword])
2929

3030
const copyPasswordToClipboard = useCallback(() => {
3131
passwordRef.current?.select();
@@ -36,11 +36,11 @@ function App() {
3636

3737
useEffect(() => {
3838
passwordGenerator()
39-
}, [length, numberAllowed, charAllowed, passwordGenerator])
39+
}, [length, charAllowed, symbolAllowed, passwordGenerator])
4040

4141
return (
4242
<>
43-
<div className='w-full b-5 max-w-md mx-auto shadow-md rounded-lg px-4 py-8 my-8 bg-amber-200 border-solid border-black text-blue-900'>
43+
<div className='w-full b-5 max-w-md mx-auto shadow-md rounded-lg px-4 py-8 my-8 bg-amber-200 border-solid border-2 border-black text-blue-900'>
4444
<h1 className='text-black font-bold text-xl text-center my-3'>Password Generator</h1>
4545
<div className='flex shadow rounded-lg font-semibold overflow-hidden mb-4'>
4646
<input
@@ -73,24 +73,24 @@ function App() {
7373
<div className='flex items-center gap-x-1'>
7474
<input
7575
type='checkbox'
76-
defaultChecked={numberAllowed}
77-
id='numberInput'
76+
defaultChecked={charAllowed}
77+
id='charInput'
7878
onChange={() => {
79-
setNumberAllowed((prev) => !prev);
79+
setCharAllowed((prev) => !prev);
8080
}}
8181
/>
82-
<label htmlFor='numberInput'>Numbers</label>
82+
<label htmlFor='charInput'>Characters</label>
8383
</div>
8484
<div className='flex items-center gap-x-1'>
8585
<input
8686
type='checkbox'
87-
defaultChecked={charAllowed}
88-
id='characterInput'
87+
defaultChecked={symbolAllowed}
88+
id='symbolInput'
8989
onChange={() => {
90-
setCharAllowed((prev) => !prev);
90+
setSymbolAllowed((prev) => !prev);
9191
}}
9292
/>
93-
<label htmlFor='characterInput'>Characters</label>
93+
<label htmlFor='symbolInput'>Symbols</label>
9494
</div>
9595
</div>
9696

project2

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)