Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2020-10-20 14:58:01 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2021-03-22 08:40:43 +0300
commitc47e79fc67ce3ac4d3b3388e97bc9c697dc5d7e6 (patch)
tree1e18a7c82bf48947bbb3b6be99ca315cc4cda3ae /apps/files_sharing/src/components
parentc8e0809d435e7ad90722be3d8a3304be73d95798 (diff)
Handle enforced password for mail shares in the WebUI
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing/src/components')
-rw-r--r--apps/files_sharing/src/components/SharingInput.vue31
1 files changed, 28 insertions, 3 deletions
diff --git a/apps/files_sharing/src/components/SharingInput.vue b/apps/files_sharing/src/components/SharingInput.vue
index ab079369f73..1f78a605c09 100644
--- a/apps/files_sharing/src/components/SharingInput.vue
+++ b/apps/files_sharing/src/components/SharingInput.vue
@@ -56,6 +56,7 @@ import debounce from 'debounce'
import Multiselect from '@nextcloud/vue/dist/Components/Multiselect'
import Config from '../services/ConfigService'
+import GeneratePassword from '../utils/GeneratePassword'
import Share from '../models/Share'
import ShareRequests from '../mixins/ShareRequests'
import ShareTypes from '../mixins/ShareTypes'
@@ -459,25 +460,49 @@ export default {
}
this.loading = true
+ console.debug('Adding a new share from the input for', value)
try {
+ let password = null
+
+ if (this.config.isPasswordForMailSharesRequired
+ && value.shareType === this.SHARE_TYPES.SHARE_TYPE_EMAIL) {
+ password = await GeneratePassword()
+ }
+
const path = (this.fileInfo.path + '/' + this.fileInfo.name).replace('//', '/')
const share = await this.createShare({
path,
shareType: value.shareType,
shareWith: value.shareWith,
+ password,
permissions: this.fileInfo.sharePermissions & OC.getCapabilities().files_sharing.default_permissions,
})
- this.$emit('add:share', share)
- this.getRecommendations()
+ // If we had a password, we need to show it to the user as it was generated
+ if (password) {
+ share.newPassword = password
+ // Wait for the newly added share
+ const component = await new Promise(resolve => {
+ this.$emit('add:share', share, resolve)
+ })
+
+ // open the menu on the
+ // freshly created share component
+ component.open = true
+ } else {
+ // Else we just add it normally
+ this.$emit('add:share', share)
+ }
- } catch (response) {
+ await this.getRecommendations()
+ } catch (error) {
// focus back if any error
const input = this.$refs.multiselect.$el.querySelector('input')
if (input) {
input.focus()
}
this.query = value.shareWith
+ console.error('Error while adding new share', error)
} finally {
this.loading = false
}