forked from tools/josh
1
0
Fork 0

Hide password while entering

This commit is contained in:
Florine W. Dekker 2018-11-29 16:19:50 +01:00
parent f62fab1372
commit 2d723647ed
Signed by: FWDekker
GPG Key ID: B1B567AF58D6EE0F
2 changed files with 14 additions and 1 deletions

View File

@ -92,3 +92,9 @@ a:hover {
#terminalCurrentFocusInput br {
display: none;
}
.terminalCurrentFocusInputHidden {
max-width: 1px !important;
overflow: hidden !important;
overflow-wrap: normal !important;
}

View File

@ -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());