aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoah Hefner <noahhefner@users.noreply.github.com>2021-07-16 10:44:12 -0400
committerGitHub <noreply@github.com>2021-07-16 07:44:12 -0700
commita283fe4628aad3750be0cd300983b9a3100fdf05 (patch)
tree6d03f2eb43c33dd51a5245aab873dc733b3a62e3
parentafca06a7963a3acaa5ea8badb71038a5e216cda5 (diff)
[Issue #44] Hide password when using "None" encryption (#56)
* 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
-rw-r--r--src/components/Card.js26
-rw-r--r--src/components/style.css4
2 files changed, 23 insertions, 7 deletions
diff --git a/src/components/Card.js b/src/components/Card.js
index c301bbe..7409d6c 100644
--- a/src/components/Card.js
+++ b/src/components/Card.js
@@ -89,13 +89,21 @@ export const Card = () => {
89 value={network.ssid} 89 value={network.ssid}
90 onChange={(e) => setNetwork({ ...network, ssid: e.target.value })} 90 onChange={(e) => setNetwork({ ...network, ssid: e.target.value })}
91 /> 91 />
92 <label className={network.hidePassword ? 'no-print' : ''}> 92 <label
93 className={`
94 ${network.hidePassword && 'no-print hidden'}
95 ${network.encryptionMode === 'nopass' && 'hidden'}
96 `}
97 >
93 Password 98 Password
94 </label> 99 </label>
95 <textarea 100 <textarea
96 id="password" 101 id="password"
97 type="text" 102 type="text"
98 className={network.hidePassword ? 'no-print' : ''} 103 className={`
104 ${network.hidePassword && 'no-print hidden'}
105 ${network.encryptionMode === 'nopass' && 'hidden'}
106 `}
99 style={{ 107 style={{
100 height: 108 height:
101 portrait && network.password.length > 40 ? '5em' : 'auto', 109 portrait && network.password.length > 40 ? '5em' : 'auto',
@@ -116,6 +124,7 @@ export const Card = () => {
116 <input 124 <input
117 type="checkbox" 125 type="checkbox"
118 id="hide-password-checkbox" 126 id="hide-password-checkbox"
127 className={network.encryptionMode === 'nopass' ? 'hidden' : ''}
119 onChange={() => 128 onChange={() =>
120 setNetwork({ 129 setNetwork({
121 ...network, 130 ...network,
@@ -123,8 +132,11 @@ export const Card = () => {
123 }) 132 })
124 } 133 }
125 /> 134 />
126 <label for="hide-password-checkbox"> 135 <label
127 Hide password field before printing 136 for="hide-password-checkbox"
137 className={network.encryptionMode === 'nopass' ? 'hidden' : ''}
138 >
139 Hide password
128 </label> 140 </label>
129 </div> 141 </div>
130 142
@@ -135,9 +147,9 @@ export const Card = () => {
135 name="encrypt-select" 147 name="encrypt-select"
136 id="encrypt-none" 148 id="encrypt-none"
137 value="nopass" 149 value="nopass"
138 onChange={(e) => { 150 onChange={(e) =>
139 setNetwork({ ...network, encryptionMode: e.target.value }); 151 setNetwork({ ...network, encryptionMode: e.target.value })
140 }} 152 }
141 /> 153 />
142 <label for="encrypt-none">None</label> 154 <label for="encrypt-none">None</label>
143 <input 155 <input
diff --git a/src/components/style.css b/src/components/style.css
index b874a57..e6973f0 100644
--- a/src/components/style.css
+++ b/src/components/style.css
@@ -17,6 +17,10 @@
17 margin-bottom: 1em; 17 margin-bottom: 1em;
18} 18}
19 19
20.hidden {
21 display: none;
22}
23
20textarea { 24textarea {
21 background-color: #fff; 25 background-color: #fff;
22 border: solid 1px #ddd; 26 border: solid 1px #ddd;