Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue #44] Hide password when using "None" encryption #56

Merged
merged 4 commits into from
Jul 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 19 additions & 7 deletions src/components/Card.js
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
margin-bottom: 1em;
}

.hidden {
display: none;
}

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