Skip to content

Commit

Permalink
Merge aa22ac0 into ed2bb57
Browse files Browse the repository at this point in the history
  • Loading branch information
backportbot-libresign[bot] committed Apr 1, 2023
2 parents ed2bb57 + aa22ac0 commit 8f9b579
Show file tree
Hide file tree
Showing 4 changed files with 76 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/Service/FolderService.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace OCA\Libresign\Service;

use OCA\Libresign\AppInfo\Application;
use OCP\Files\Folder;
use OCP\Files\IRootFolder;
use OCP\Files\NotFoundException;
Expand Down Expand Up @@ -91,7 +92,8 @@ public function getLibreSignDefaultPath(): string {
$path = $this->config->getUserValue($this->userId, 'libresign', 'folder');

if (empty($path)) {
$path = '/' . $this->l10n->t('LibreSign');
$defaultFolder = $this->config->getAppValue(Application::APP_ID, 'default_user_folder', 'LibreSign');
$path = '/' . $defaultFolder;
$this->config->setUserValue($this->userId, 'libresign', 'folder', $path);
}

Expand Down
6 changes: 5 additions & 1 deletion src/views/CreatePassword.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ export default {
this.$emit('close', true)
this.$emit('change-pfx', true)
} catch (err) {
showError(t('libresign', 'Error creating new password, please contact the administrator'))
if (err.response.data.message) {
showError(err.response.data.message)
} else {
showError(t('libresign', 'Error creating new password, please contact the administrator'))
}
this.hasLoading = false
this.$emit('change-pfx', false)
}
Expand Down
65 changes: 65 additions & 0 deletions src/views/Settings/DefaultUserFolder.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<template>
<NcSettingsSection :title="title" :description="description">
<div class="default-user-folder-content">
<NcCheckboxRadioSwitch
type="switch"
:checked.sync="customUserFolder">
{{ t('libresign', 'Customize default user folder') }}
</NcCheckboxRadioSwitch>
<div v-if="customUserFolder">
<NcTextField
:placeholder="t('libresign', 'Customize default user folder')"
:value.sync="value"
@update:value="saveDefaultUserFolder" />
</div>
</div>
</NcSettingsSection>
</template>
<script>
import { translate as t } from '@nextcloud/l10n'
import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection'
import NcTextField from '@nextcloud/vue/dist/Components/NcTextField'
import NcCheckboxRadioSwitch from '@nextcloud/vue/dist/Components/NcCheckboxRadioSwitch'
import { generateOcsUrl } from '@nextcloud/router'
import axios from '@nextcloud/axios'
export default {
name: 'DefaultUserFolder',
components: {
NcSettingsSection,
NcTextField,
NcCheckboxRadioSwitch,
},
data() {
return {
title: t('libresign', 'Customize default user folder'),
description: t('libresign', 'Name of the folder that will contain the user\'s digital certificate, visible signature images, and other files related to LibreSign.'),
value: '',
customUserFolder: false,
}
},
created() {
this.getData()
},
methods: {
async getData() {
const response = await axios.get(generateOcsUrl('/apps/provisioning_api/api/v1', 2) + '/config/apps/libresign/default_user_folder', {})
this.customUserFolder = response.data.ocs.data.data ? true : false
this.value = response.data.ocs.data.data || 'LibreSign'
},
saveDefaultUserFolder() {
OCP.AppConfig.setValue('libresign', 'default_user_folder', this.value)
},
},
}
</script>
<style scoped>
.default-user-folder-content{
display: flex;
flex-direction: column;
}
textarea {
width: 50%;
height: 150px;
}
</style>
3 changes: 3 additions & 0 deletions src/views/Settings/Settings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<LegalInformation />
<IdentificationDocuments />
<CollectMetadata />
<DefaultUserFolder />
</NcSettingsSection>
</template>

Expand All @@ -44,6 +45,7 @@ import AllowedGroups from './AllowedGroups.vue'
import LegalInformation from './LegalInformation.vue'
import IdentificationDocuments from './IdentificationDocuments.vue'
import CollectMetadata from './CollectMetadata.vue'
import DefaultUserFolder from './DefaultUserFolder.vue'
export default {
name: 'Settings',
Expand All @@ -57,6 +59,7 @@ export default {
LegalInformation,
IdentificationDocuments,
CollectMetadata,
DefaultUserFolder,
},
data() {
return {
Expand Down

0 comments on commit 8f9b579

Please sign in to comment.