1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-04 08:28:11 +00:00

hide/show stored password

This commit is contained in:
lian
2021-11-23 12:09:08 +08:00
parent ae03124860
commit c21a3e9bd7
4 changed files with 33 additions and 1 deletions

View File

@@ -56,6 +56,7 @@ class GenerateShareLink extends React.Component {
expDate: null,
password: '',
passwdnew: '',
storedPasswordVisible: false,
errorInfo: '',
sharedLinkInfo: null,
isNoticeMessageShow: false,
@@ -181,6 +182,12 @@ class GenerateShareLink extends React.Component {
this.setState({passwdnew: passwd});
}
toggleStoredPasswordVisible = () => {
this.setState({
storedPasswordVisible: !this.state.storedPasswordVisible
});
}
setPermission = (e) => {
this.setState({currentPermission: e.target.value});
}
@@ -404,7 +411,10 @@ class GenerateShareLink extends React.Component {
<FormGroup className="mb-0">
<dt className="text-secondary font-weight-normal">{gettext('Password:')}</dt>
<dd className="d-flex">
<span>{sharedLinkInfo.password}</span>
<div className="d-flex align-items-center">
<input id="stored-password" className="border-0 mr-1" type="text" value={this.state.storedPasswordVisible ? sharedLinkInfo.password : '****************************************'} readOnly={true} size={Math.max(sharedLinkInfo.password.length, 10)} />
<span tabIndex="0" role="button" aria-label={this.state.storedPasswordVisible ? gettext('Hide') : gettext('Show')} onKeyDown={this.onIconKeyDown} onClick={this.toggleStoredPasswordVisible} className={`eye-icon fas ${this.state.storedPasswordVisible ? 'fa-eye': 'fa-eye-slash'}`}></span>
</div>
</dd>
</FormGroup>
)}