borgbutler-webapp/src/components/views/repos/ConfigureRepoPage.jsx
@@ -19,12 +19,12 @@ constructor(props) { super(props); this.handleRepoConfigChange = this.handleRepoConfigChange.bind(this); this.handleInputChange = this.handleInputChange.bind(this); this.handleCheckboxChange = this.handleCheckboxChange.bind(this); this.setRepoValue = this.setRepoValue.bind(this); this.state = { repoConfig: { encryption: 'repoKey' }, repoConfig: {}, encryption: 'repoKey', mode: 'existingRepo', localRemote: 'local' }; @@ -39,6 +39,11 @@ this.setState({repoConfig: {...this.state.repoConfig, [variable]: value}}) } handleInputChange = (event) => { event.preventDefault(); this.setState({[event.target.name]: event.target.value}); }; handleCheckboxChange = event => { this.setState({[event.target.name]: event.target.value}); /*if (event.target.name === 'mode' && event.target.value === 'existingRepo' @@ -91,9 +96,9 @@ <FormLabel length={2}>{'Encryption'}</FormLabel> <FormField length={4}> <FormSelect value={repoConfig.encryption} value={this.state.encryption} name={'encryption'} onChange={this.handleRepoConfigChange} onChange={this.handleInputChange} hint={'Encryption for the new repository (use repokey if you don\'t know what to choose).'} > <FormOption label={'repokey (SHA256)'} value={'repokey'}/> @@ -103,7 +108,7 @@ </FormSelect> </FormField> </FormGroup> <RepoConfigPasswordPanel encryption={this.state.repoConfig.encryption} <RepoConfigPasswordPanel passwordMethod={this.state.encryption === 'none' ? 'none' : 'yes'} repoConfig={repoConfig} handleRepoConfigChange={this.handleRepoConfigChange} setRepoValue={this.setRepoValue}/> borgbutler-webapp/src/components/views/repos/RepoConfigPanel.jsx
@@ -110,14 +110,14 @@ />; } else if (this.state.repoConfig) { const repoConfig = this.state.repoConfig; let encryption = 'undefined'; // Todo const remote = (repoConfig.rsh && repoConfig.rsh.length > 0) || (repoConfig.repo && repoConfig.repo.indexOf('@') >= 0); const remote = (repoConfig.rsh && repoConfig.rsh.length > 0) || (repoConfig.repo && (repoConfig.repo.indexOf('@') >= 0 || repoConfig.repo.indexOf('ssh://') >= 0)); content = <React.Fragment> <RepoConfigBasePanel repoConfig={repoConfig} remote={remote} handleRepoConfigChange={this.handleRepoConfigChange} setRepoValue={this.setRepoValue}/> <RepoConfigPasswordPanel encryption={encryption} <RepoConfigPasswordPanel passwordMethod={'auto'} repoConfig={repoConfig} handleRepoConfigChange={this.handleRepoConfigChange} setRepoValue={this.setRepoValue}/> borgbutler-webapp/src/components/views/repos/RepoConfigPasswordPanel.jsx
@@ -14,11 +14,31 @@ constructor(props) { super(props); this.handlePasswordMethodChange = this.handlePasswordMethodChange.bind(this); let passwordMethod = this.props.passwordMethod; if (passwordMethod === 'auto') { const repoConfig = this.props.repoConfig; passwordMethod = 'passwordCommand'; if (repoConfig.passwordCommand && repoConfig.passwordCommand.length > 0) { if (repoConfig.passwordCommand.indexOf('find-generic-password') > 0) { passwordMethod = 'macos-keychain'; } else if (repoConfig.passwordCommand.indexOf('secret-tool') > 0) { passwordMethod = 'gnome-keyring'; } else if (repoConfig.passwordCommand.indexOf('kwallet') > 0) { passwordMethod = 'kwallet'; } else { passwordMethod = 'passwordCommand'; // Default. } } else if (repoConfig.passphrase && repoConfig.passphrase.length > 0) { passwordMethod = 'passphrase'; } else { passwordMethod = 'passwordCommand'; // Default. } } this.state = { passwordMethod: 'passwordCommand', passwordMethod: passwordMethod, passwordCreate: null }; this.handlePasswordMethodChange = this.handlePasswordMethodChange.bind(this); } handlePasswordMethodChange = event => { @@ -86,13 +106,10 @@ ['passphrase', 'Passphrase (not recommended)'], ['none', 'No password (no encryption, not recommended)'] ]; let encrypted = true; if (this.props.encryption === 'none' || this.state.passwordMethod === 'none') { encrypted = false; } let encrypted = this.props.passwordMethod !== 'none' && this.state.passwordMethod !== 'none'; return <React.Fragment> <FormGroup className={this.props.encryption === 'none' ? 'hidden' : null} className={this.props.passwordMethod === 'none' ? 'hidden' : null} > <FormLabel length={2}>{'Password method'}</FormLabel> <FormField length={4}> @@ -144,7 +161,7 @@ <Alert color={'danger'} > You backup isn't encrpyted! You should ensure, that your destination storage is encrypted You backup isn't encrypted! You should ensure, that your destination storage is encrypted and protected. </Alert> </FormField> @@ -157,11 +174,11 @@ handleRepoConfigChange: PropTypes.func.isRequired, setRepoValue: PropTypes.func.isRequired, repoConfig: PropTypes.object.isRequired, encryption: PropTypes.string passwordMethod: PropTypes.string }; RepoConfigPasswordPanel.defaultProps = { encryption: 'none' passwordMethod: 'auto' }; export default RepoConfigPasswordPanel;