forked from tools/josh
Hide password while entering
This commit is contained in:
parent
f62fab1372
commit
2d723647ed
|
@ -92,3 +92,9 @@ a:hover {
|
|||
#terminalCurrentFocusInput br {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.terminalCurrentFocusInputHidden {
|
||||
max-width: 1px !important;
|
||||
overflow: hidden !important;
|
||||
overflow-wrap: normal !important;
|
||||
}
|
||||
|
|
|
@ -87,14 +87,21 @@ class Terminal {
|
|||
|
||||
continueLogin(input) {
|
||||
if (this._user === undefined) {
|
||||
this.outputText += `${this.prefixText}${input}\n`;
|
||||
|
||||
this._user = input.trim();
|
||||
this._input.classList.add("terminalCurrentFocusInputHidden");
|
||||
} else {
|
||||
this.outputText += `${this.prefixText}\n`;
|
||||
|
||||
if (this._user === "felix" && input === "hotel123") {
|
||||
this._loggedIn = true;
|
||||
} else {
|
||||
this.outputText += "Access denied\n";
|
||||
this._user = undefined;
|
||||
}
|
||||
|
||||
this._input.classList.remove("terminalCurrentFocusInputHidden");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,11 +115,11 @@ class Terminal {
|
|||
|
||||
processInput(input) {
|
||||
this.inputText = "";
|
||||
this.outputText += `${this.prefixText}${input}\n`;
|
||||
|
||||
if (!this._loggedIn) {
|
||||
this.continueLogin(input);
|
||||
} else {
|
||||
this.outputText += `${this.prefixText}${input}\n`;
|
||||
this._inputHistory.addEntry(input);
|
||||
|
||||
const output = this._commands.parse(input.trim());
|
||||
|
|
Loading…
Reference in New Issue