Skip to content

Commit

Permalink
[Issue #44] Hide password when using "None" encryption (#56)
Browse files Browse the repository at this point in the history
* Changes behavior of password textarea when None encryption is selected

* prettier

* password text area hides on checking hide password tikbox

* className re-structuring, changed Hide Password
  • Loading branch information
noahhefner committed Jul 16, 2021
1 parent afca06a commit a283fe4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
26 changes: 19 additions & 7 deletions src/components/Card.js
Expand Up @@ -89,13 +89,21 @@ export const Card = () => {
value={network.ssid}
onChange={(e) => setNetwork({ ...network, ssid: e.target.value })}
/>
<label className={network.hidePassword ? 'no-print' : ''}>
<label
className={`
${network.hidePassword && 'no-print hidden'}
${network.encryptionMode === 'nopass' && 'hidden'}
`}
>
Password
</label>
<textarea
id="password"
type="text"
className={network.hidePassword ? 'no-print' : ''}
className={`
${network.hidePassword && 'no-print hidden'}
${network.encryptionMode === 'nopass' && 'hidden'}
`}
style={{
height:
portrait && network.password.length > 40 ? '5em' : 'auto',
Expand All @@ -116,15 +124,19 @@ export const Card = () => {
<input
type="checkbox"
id="hide-password-checkbox"
className={network.encryptionMode === 'nopass' ? 'hidden' : ''}
onChange={() =>
setNetwork({
...network,
hidePassword: !network.hidePassword,
})
}
/>
<label for="hide-password-checkbox">
Hide password field before printing
<label
for="hide-password-checkbox"
className={network.encryptionMode === 'nopass' ? 'hidden' : ''}
>
Hide password
</label>
</div>

Expand All @@ -135,9 +147,9 @@ export const Card = () => {
name="encrypt-select"
id="encrypt-none"
value="nopass"
onChange={(e) => {
setNetwork({ ...network, encryptionMode: e.target.value });
}}
onChange={(e) =>
setNetwork({ ...network, encryptionMode: e.target.value })
}
/>
<label for="encrypt-none">None</label>
<input
Expand Down
4 changes: 4 additions & 0 deletions src/components/style.css
Expand Up @@ -17,6 +17,10 @@
margin-bottom: 1em;
}

.hidden {
display: none;
}

textarea {
background-color: #fff;
border: solid 1px #ddd;
Expand Down

0 comments on commit a283fe4

Please sign in to comment.