Skip to content

Commit b93865c

Browse files
committed
Add password field
1 parent 8dc08b2 commit b93865c

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

JavaScript/7-login.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,17 @@
22

33
const write = s => process.stdout.write(s);
44

5+
let login = '';
6+
let password = '';
7+
58
process.stdin.on('data', chunk => {
6-
write(`\nHello, ${chunk.toString().trim()}!`);
9+
if (!login) {
10+
login = chunk.toString().trim();
11+
write('\x1b[13;34H');
12+
} else {
13+
password = chunk.toString().trim();
14+
write(`\nHello, ${login}!\n Your password is: ${password}`);
15+
}
716
});
817

918
write('\x1Bc');
@@ -15,9 +24,10 @@ setTimeout(() => {
1524
}, 10000);
1625

1726
write(`
18-
┌────────────────────────────┐
19-
│ Login: │
20-
└────────────────────────────┘
27+
┌───────────────────────────────┐
28+
│ Login: │
29+
│ Password: │
30+
└───────────────────────────────┘
2131
`);
2232

23-
write('\x1b[2A\x1b[31C');
33+
write('\x1b[3A\x1b[31C');

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy