diff options
| author | bndw <ben@bdw.to> | 2021-07-04 16:59:39 -0700 |
|---|---|---|
| committer | bndw <ben@bdw.to> | 2021-07-04 16:59:39 -0700 |
| commit | f3387a3bf5cdbd7b747afe0198cce4a60a7875c0 (patch) | |
| tree | b55720d69fd31254101dbed2c5b1fc696bed1732 /src/components | |
| parent | 52ff61635b1cbd4b024ae882b606cfb64d6cc897 (diff) | |
Password must be atleast 8 characters
Fixes #29
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/Card.js | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/components/Card.js b/src/components/Card.js index 16f94a4..3394859 100644 --- a/src/components/Card.js +++ b/src/components/Card.js | |||
| @@ -24,6 +24,14 @@ export const Card = () => { | |||
| 24 | return escaped; | 24 | return escaped; |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | const onPrint = () => { | ||
| 28 | if (network.password.length < 8) { | ||
| 29 | alert('Password must be atleast 8 characters'); | ||
| 30 | } else { | ||
| 31 | window.print(); | ||
| 32 | } | ||
| 33 | }; | ||
| 34 | |||
| 27 | useEffect(() => { | 35 | useEffect(() => { |
| 28 | const ssid = escape(network.ssid); | 36 | const ssid = escape(network.ssid); |
| 29 | const password = escape(network.password); | 37 | const password = escape(network.password); |
| @@ -73,7 +81,7 @@ export const Card = () => { | |||
| 73 | </p> | 81 | </p> |
| 74 | </fieldset> | 82 | </fieldset> |
| 75 | <div className="print-btn"> | 83 | <div className="print-btn"> |
| 76 | <button onClick={window.print}>Print</button> | 84 | <button onClick={onPrint}>Print</button> |
| 77 | </div> | 85 | </div> |
| 78 | </div> | 86 | </div> |
| 79 | ); | 87 | ); |
