mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-04 16:31:13 +00:00
[department] added 'change password' & 'reset password' for encrypted repo (#4674)
This commit is contained in:
@@ -4,11 +4,13 @@ import moment from 'moment';
|
|||||||
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
import { Dropdown, DropdownMenu, DropdownToggle, DropdownItem } from 'reactstrap';
|
||||||
import { Link } from '@reach/router';
|
import { Link } from '@reach/router';
|
||||||
import { Utils } from '../../utils/utils';
|
import { Utils } from '../../utils/utils';
|
||||||
import { gettext, siteRoot, isPro, username, folderPermEnabled, isSystemStaff } from '../../utils/constants';
|
import { gettext, siteRoot, isPro, username, folderPermEnabled, isSystemStaff, enableResetEncryptedRepoPassword, isEmailConfigured } from '../../utils/constants';
|
||||||
import ModalPortal from '../../components/modal-portal';
|
import ModalPortal from '../../components/modal-portal';
|
||||||
import ShareDialog from '../../components/dialog/share-dialog';
|
import ShareDialog from '../../components/dialog/share-dialog';
|
||||||
import LibSubFolderPermissionDialog from '../../components/dialog/lib-sub-folder-permission-dialog';
|
import LibSubFolderPermissionDialog from '../../components/dialog/lib-sub-folder-permission-dialog';
|
||||||
import DeleteRepoDialog from '../../components/dialog/delete-repo-dialog';
|
import DeleteRepoDialog from '../../components/dialog/delete-repo-dialog';
|
||||||
|
import ChangeRepoPasswordDialog from '../../components/dialog/change-repo-password-dialog';
|
||||||
|
import ResetEncryptedRepoPasswordDialog from '../../components/dialog/reset-encrypted-repo-password-dialog';
|
||||||
import Rename from '../rename';
|
import Rename from '../rename';
|
||||||
import { seafileAPI } from '../../utils/seafile-api';
|
import { seafileAPI } from '../../utils/seafile-api';
|
||||||
import LibHistorySettingDialog from '../dialog/lib-history-setting-dialog';
|
import LibHistorySettingDialog from '../dialog/lib-history-setting-dialog';
|
||||||
@@ -46,6 +48,8 @@ class SharedRepoListItem extends React.Component {
|
|||||||
isAPITokenDialogShow: false,
|
isAPITokenDialogShow: false,
|
||||||
isRepoShareUploadLinksDialogOpen: false,
|
isRepoShareUploadLinksDialogOpen: false,
|
||||||
isRepoDeleted: false,
|
isRepoDeleted: false,
|
||||||
|
isChangePasswordDialogShow: false,
|
||||||
|
isResetPasswordDialogShow: false
|
||||||
};
|
};
|
||||||
this.isDeparementOnwerGroupMember = false;
|
this.isDeparementOnwerGroupMember = false;
|
||||||
}
|
}
|
||||||
@@ -141,6 +145,12 @@ class SharedRepoListItem extends React.Component {
|
|||||||
case 'Share Links Admin':
|
case 'Share Links Admin':
|
||||||
this.toggleRepoShareUploadLinksDialog();
|
this.toggleRepoShareUploadLinksDialog();
|
||||||
break;
|
break;
|
||||||
|
case 'Change Password':
|
||||||
|
this.onChangePasswordToggle();
|
||||||
|
break;
|
||||||
|
case 'Reset Password':
|
||||||
|
this.onResetPasswordToggle();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -231,6 +241,14 @@ class SharedRepoListItem extends React.Component {
|
|||||||
this.setState({isAPITokenDialogShow: !this.state.isAPITokenDialogShow});
|
this.setState({isAPITokenDialogShow: !this.state.isAPITokenDialogShow});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onChangePasswordToggle = () => {
|
||||||
|
this.setState({isChangePasswordDialogShow: !this.state.isChangePasswordDialogShow});
|
||||||
|
}
|
||||||
|
|
||||||
|
onResetPasswordToggle = () => {
|
||||||
|
this.setState({isResetPasswordDialogShow: !this.state.isResetPasswordDialogShow});
|
||||||
|
}
|
||||||
|
|
||||||
translateMenuItem = (menuItem) => {
|
translateMenuItem = (menuItem) => {
|
||||||
let translateResult = '';
|
let translateResult = '';
|
||||||
switch(menuItem) {
|
switch(menuItem) {
|
||||||
@@ -255,6 +273,12 @@ class SharedRepoListItem extends React.Component {
|
|||||||
case 'Share Links Admin':
|
case 'Share Links Admin':
|
||||||
translateResult = gettext('Share Links Admin');
|
translateResult = gettext('Share Links Admin');
|
||||||
break;
|
break;
|
||||||
|
case 'Change Password':
|
||||||
|
translateResult = gettext('Change Password');
|
||||||
|
break;
|
||||||
|
case 'Reset Password':
|
||||||
|
translateResult = gettext('Reset Password');
|
||||||
|
break;
|
||||||
case 'API Token':
|
case 'API Token':
|
||||||
translateResult = 'API Token'; // translation is not needed here
|
translateResult = 'API Token'; // translation is not needed here
|
||||||
break;
|
break;
|
||||||
@@ -280,7 +304,14 @@ class SharedRepoListItem extends React.Component {
|
|||||||
if (folderPermEnabled) {
|
if (folderPermEnabled) {
|
||||||
operations.push('Folder Permission');
|
operations.push('Folder Permission');
|
||||||
}
|
}
|
||||||
operations.push('Share Links Admin', 'History Setting', 'API Token', 'Details');
|
operations.push('Share Links Admin');
|
||||||
|
if (repo.encrypted) {
|
||||||
|
operations.push('Change Password');
|
||||||
|
}
|
||||||
|
if (repo.encrypted && enableResetEncryptedRepoPassword && isEmailConfigured) {
|
||||||
|
operations.push('Reset Password');
|
||||||
|
}
|
||||||
|
operations.push('History Setting', 'API Token', 'Details');
|
||||||
} else {
|
} else {
|
||||||
operations.push('Unshare');
|
operations.push('Unshare');
|
||||||
}
|
}
|
||||||
@@ -538,6 +569,23 @@ class SharedRepoListItem extends React.Component {
|
|||||||
/>
|
/>
|
||||||
</ModalPortal>
|
</ModalPortal>
|
||||||
)}
|
)}
|
||||||
|
{this.state.isChangePasswordDialogShow && (
|
||||||
|
<ModalPortal>
|
||||||
|
<ChangeRepoPasswordDialog
|
||||||
|
repoID={repo.repo_id}
|
||||||
|
repoName={repo.repo_name}
|
||||||
|
toggleDialog={this.onChangePasswordToggle}
|
||||||
|
/>
|
||||||
|
</ModalPortal>
|
||||||
|
)}
|
||||||
|
{this.state.isResetPasswordDialogShow && (
|
||||||
|
<ModalPortal>
|
||||||
|
<ResetEncryptedRepoPasswordDialog
|
||||||
|
repoID={repo.repo_id}
|
||||||
|
toggleDialog={this.onResetPasswordToggle}
|
||||||
|
/>
|
||||||
|
</ModalPortal>
|
||||||
|
)}
|
||||||
</Fragment>
|
</Fragment>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user