1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 07:55:36 +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>
)}

View File

@@ -46,6 +46,7 @@ class GenerateUploadLink extends React.Component {
passwordVisible: false,
password: '',
passwordnew: '',
storedPasswordVisible: false,
sharedUploadInfo: null,
isSendLinkShown: false,
isExpireChecked: !this.isExpireDaysNoLimit,
@@ -111,6 +112,12 @@ class GenerateUploadLink extends React.Component {
});
}
toggleStoredPasswordVisible = () => {
this.setState({
storedPasswordVisible: !this.state.storedPasswordVisible
});
}
generateUploadLink = () => {
let isValid = this.validateParamsInput();
if (isValid) {
@@ -279,6 +286,19 @@ class GenerateUploadLink extends React.Component {
/>
</dd>
</FormGroup>
{sharedUploadInfo.password && (
<FormGroup className="mb-0">
<dt className="text-secondary font-weight-normal">{gettext('Password:')}</dt>
<dd className="d-flex">
<div className="d-flex align-items-center">
<input id="stored-password" className="border-0 mr-1" type="text" value={this.state.storedPasswordVisible ? sharedUploadInfo.password : '****************************************'} readOnly={true} size={Math.max(sharedUploadInfo.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>
)}
{sharedUploadInfo.expire_date && (
<FormGroup className="mb-0">
<dt className="text-secondary font-weight-normal">{gettext('Expiration Date:')}</dt>