This commit is contained in:
sawka 2022-10-04 10:52:55 -07:00
parent 4e76514f1b
commit 0173cbce23
2 changed files with 24 additions and 0 deletions

View File

@ -976,6 +976,21 @@ class InfoRemoteEdit extends React.Component<{}, {}> {
}
}
canResetPw() : boolean {
let redit = this.getRemoteEdit();
if (redit == null) {
return false;
}
return redit.haspassword && this.passwordStr.get() != PasswordUnchangedSentinel;
}
@boundMethod
resetPw() : void {
mobx.action(() => {
this.passwordStr.set(PasswordUnchangedSentinel);
})();
}
@boundMethod
doSubmitRemote() {
let redit = this.getRemoteEdit();
@ -1253,6 +1268,9 @@ class InfoRemoteEdit extends React.Component<{}, {}> {
<div className="remote-field-label">ssh password</div>
<div className="remote-field-control text-input">
<input type="password" onFocus={this.onFocusPasswordStr} onChange={this.onChangePasswordStr} value={this.passwordStr.get()}/>
<If condition={this.canResetPw()}>
<i onClick={this.resetPw} title="restore to original password" className="icon fa fa-undo undo-icon"/>
</If>
</div>
</div>
</If>

View File

@ -905,6 +905,12 @@ body .xterm .xterm-viewport {
color: @term-bright-white;
}
.undo-icon {
margin-left: 4px;
cursor: pointer;
padding: 2px;
}
.remote-field-control {
&.text-control {
}