1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-05 00:43:53 +00:00

update create encrypt repo

This commit is contained in:
ilearnit
2018-12-17 09:26:27 +00:00
parent d2ff0bb5eb
commit aa3b408e3a
4 changed files with 32 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react'; import React from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { Button, Modal, ModalHeader, Input, ModalBody, ModalFooter, Form, FormGroup, Label } from 'reactstrap'; import { Button, Modal, ModalHeader, Input, ModalBody, ModalFooter, Form, FormGroup, Label } from 'reactstrap';
import { gettext } from '../../utils/constants'; import { gettext, enableEncryptedLibrary } from '../../utils/constants';
const propTypes = { const propTypes = {
libraryType: PropTypes.string.isRequired, libraryType: PropTypes.string.isRequired,
@@ -170,30 +170,34 @@ class CreateRepoDialog extends React.Component {
</Input> </Input>
</FormGroup> </FormGroup>
)} )}
<FormGroup check> {enableEncryptedLibrary &&
<Input type="checkbox" id="encrypt" onChange={this.onEncrypted}/> <div>
<Label for="encrypt">{gettext('Encrypt')}</Label> <FormGroup check>
</FormGroup> <Input type="checkbox" id="encrypt" onChange={this.onEncrypted}/>
<FormGroup> <Label for="encrypt">{gettext('Encrypt')}</Label>
<Label for="passwd1">{gettext('Password')}{' '}<span className="tip">({gettext('at least 8 characters')})</span></Label> </FormGroup>
<Input <FormGroup>
id="passwd1" <Label for="passwd1">{gettext('Password')}{' '}<span className="tip">({gettext('at least 8 characters')})</span></Label>
type="password" <Input
disabled={this.state.disabled} id="passwd1"
value={this.state.password1} type="password"
onChange={this.handlePassword1Change} disabled={this.state.disabled}
/> value={this.state.password1}
</FormGroup> onChange={this.handlePassword1Change}
<FormGroup> />
<Label for="passwd2">{gettext('Password again')}</Label> </FormGroup>
<Input <FormGroup>
id="passwd2" <Label for="passwd2">{gettext('Password again')}</Label>
type="password" <Input
disabled={this.state.disabled} id="passwd2"
value={this.state.password2} type="password"
onChange={this.handlePassword2Change} disabled={this.state.disabled}
/> value={this.state.password2}
</FormGroup> onChange={this.handlePassword2Change}
/>
</FormGroup>
</div>
}
</Form> </Form>
<Label className="err-message">{gettext(this.state.errMessage)}</Label> <Label className="err-message">{gettext(this.state.errMessage)}</Label>
</ModalBody> </ModalBody>

View File

@@ -29,6 +29,7 @@ export const shareLinkExpireDaysMin = window.app.pageOptions.shareLinkExpireDays
export const shareLinkExpireDaysMax = window.app.pageOptions.shareLinkExpireDaysMax; export const shareLinkExpireDaysMax = window.app.pageOptions.shareLinkExpireDaysMax;
export const maxFileName = window.app.pageOptions.maxFileName; export const maxFileName = window.app.pageOptions.maxFileName;
export const enableWiki = window.app.pageOptions.enableWiki; export const enableWiki = window.app.pageOptions.enableWiki;
export const enableEncryptedLibrary = window.app.pageOptions.enableEncryptedLibrary === '1';
// wiki // wiki
export const slug = window.wiki ? window.wiki.config.slug : ''; export const slug = window.wiki ? window.wiki.config.slug : '';

View File

@@ -63,6 +63,7 @@
shareLinkExpireDaysMax: "{{ share_link_expire_days_max }}", shareLinkExpireDaysMax: "{{ share_link_expire_days_max }}",
maxFileName: "{{ max_file_name }}", maxFileName: "{{ max_file_name }}",
enableWiki: {% if enable_wiki %} true {% else %} false {% endif %}, enableWiki: {% if enable_wiki %} true {% else %} false {% endif %},
enableEncryptedLibrary: '{{ enable_encrypted_library }}',
} }
}; };
</script> </script>

View File

@@ -718,6 +718,7 @@ def libraries(request):
'enable_repo_snapshot_label': settings.ENABLE_REPO_SNAPSHOT_LABEL, 'enable_repo_snapshot_label': settings.ENABLE_REPO_SNAPSHOT_LABEL,
'share_link_expire_days_min': SHARE_LINK_EXPIRE_DAYS_MIN, 'share_link_expire_days_min': SHARE_LINK_EXPIRE_DAYS_MIN,
'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX, 'share_link_expire_days_max': SHARE_LINK_EXPIRE_DAYS_MAX,
'enable_encrypted_library': config.ENABLE_ENCRYPTED_LIBRARY,
}) })
return render(request, 'libraries.html', { return render(request, 'libraries.html', {