Replies: 2 comments 11 replies
-
A process prompting you for password input normally would switch the echo mode of the TTY off. Thats what you'll see with things like |
Beta Was this translation helpful? Give feedback.
4 replies
-
this was my original code managing xterm
```
const socket = new WebSocket("ws://localhost:3000/console");
const term = new Terminal({cursorBlink: true, convertEol: true});
const fitAddon = new FitAddon.FitAddon();
term.loadAddon(fitAddon);
term.open(document.getElementById('terminal'));
fitAddon.fit();
function init() {
if (term._intialized) {
return;
}
term._initialized = true;
term.prompt = () => {
term.write('\r\n$ ');
};
prompt(term);
term.onData(e => {
switch (e) {
case '\u0003': // Ctrl+C
term.write('^C');
prompt(term);
break;
case '\r': // Enter
runCommand(term, command);
command = '';
break;
case '\u007F': // Backspace (DEL)
// Do not delete the prompt
if (term._core.buffer.x > 2) {
term.write('\b \b');
if (command.length > 0) {
command = command.substr(0, command.length - 1);
}
}
break;
case '\u0009':
console.log('tabbed', output, ["dd", "ls"]);
break;
default:
if (e >= String.fromCharCode(0x20) && e <= String.fromCharCode(0x7E) || e >= '\u00a0') {
command += e;
term.write(e);
}
}
});
}
function clearInput(command) {
var inputLengh = command.length;
for (var i = 0; i < inputLengh; i++) {
term.write('\b \b');
}
}
function prompt(term) {
command = '';
term.write('\r\n$ ');
}
socket.onmessage = (event) => {
term.write(event.data);
}
function runCommand(term, command) {
// if (command.length > 0) {
clearInput(command);
socket.send(command + '\n');
return;
// }
}
```
and this is now
```
socket = new WebSocket("ws://localhost:3000/console/" + route.params.xname);
const attachAddon = new AttachAddon(socket);
term.loadAddon(attachAddon);
term.loadAddon(fitAddon);
term.open(document.getElementById('terminal'));
```
…________________________________
From: jerch ***@***.***>
Sent: Saturday, 29 April 2023 10:29
To: xtermjs/xterm.js ***@***.***>
Cc: Masber ***@***.***>; State change ***@***.***>
Subject: Re: [xtermjs/xterm.js] how to hide when user types passwords (Discussion #4497)
Now I wonder how the attach addon may have helped you with not showing password input, and if your solution is really secure 🤔 ...
—
Reply to this email directly, view it on GitHub<#4497 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AAFQJEA2QAFS52YLZ4MUKMTXDTGNJANCNFSM6AAAAAAXPEUBCM>.
You are receiving this because you modified the open/close state.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Dear xterm community,
I am learning xterm, I have a web server with a websocket I use to connect xterm to, the web server will redirect the I/O between the xterm client and the terminal I want to run the commands to.
This works so far, however, the first thing the terminal asks is for a login and a password, unfortunately, the xterm is showing plain text as I type the password and I would like to hyde it.
Any idea how to do this?
thank you very much
Beta Was this translation helpful? Give feedback.
All reactions