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:
Diffstat (limited to 'apps/files_sharing/src')
-rw-r--r--apps/files_sharing/src/components/SharingEntryLink.vue20
-rw-r--r--apps/files_sharing/src/mixins/ShareRequests.js3
-rw-r--r--apps/files_sharing/src/mixins/SharesMixin.js5
-rw-r--r--apps/files_sharing/src/models/Share.js21
4 files changed, 47 insertions, 2 deletions
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue
index ee7e8d4b930..638cdf485b0 100644
--- a/apps/files_sharing/src/components/SharingEntryLink.vue
+++ b/apps/files_sharing/src/components/SharingEntryLink.vue
@@ -192,6 +192,12 @@
@submit="onPasswordSubmit">
{{ t('files_sharing', 'Enter a password') }}
</ActionInput>
+ <ActionText v-if="isEmailShareType && passwordExpirationTime" icon="icon-info">
+ {{ t('files_sharing', 'Password expires {passwordExpirationTime}', {passwordExpirationTime}) }}
+ </ActionText>
+ <ActionText v-else-if="isEmailShareType && passwordExpirationTime !== null" icon="icon-error">
+ {{ t('files_sharing', 'Password expired') }}
+ </ActionText>
<!-- password protected by Talk -->
<ActionCheckbox v-if="isPasswordProtectedByTalkAvailable"
@@ -461,6 +467,20 @@ export default {
},
},
+ passwordExpirationTime() {
+ if (this.share.passwordExpirationTime === null) {
+ return null
+ }
+
+ const expirationTime = moment(this.share.passwordExpirationTime)
+
+ if (expirationTime.diff(moment()) < 0) {
+ return false
+ }
+
+ return expirationTime.fromNow()
+ },
+
/**
* Is Talk enabled?
*
diff --git a/apps/files_sharing/src/mixins/ShareRequests.js b/apps/files_sharing/src/mixins/ShareRequests.js
index bc6e3bf1644..e2668c15d65 100644
--- a/apps/files_sharing/src/mixins/ShareRequests.js
+++ b/apps/files_sharing/src/mixins/ShareRequests.js
@@ -103,8 +103,9 @@ export default {
const request = await axios.put(shareUrl + `/${id}`, properties)
if (!request?.data?.ocs) {
throw request
+ } else {
+ return request.data.ocs.data
}
- return true
} catch (error) {
console.error('Error while updating share', error)
if (error.response.status !== 400) {
diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js
index 950b0355175..daeacfa4b8b 100644
--- a/apps/files_sharing/src/mixins/SharesMixin.js
+++ b/apps/files_sharing/src/mixins/SharesMixin.js
@@ -235,11 +235,14 @@ export default {
this.saving = true
this.errors = {}
try {
- await this.updateShare(this.share.id, properties)
+ const updatedShare = await this.updateShare(this.share.id, properties)
if (propertyNames.indexOf('password') >= 0) {
// reset password state after sync
this.$delete(this.share, 'newPassword')
+
+ // updates password expiration time after sync
+ this.share.passwordExpirationTime = updatedShare.password_expiration_time
}
// clear any previous errors
diff --git a/apps/files_sharing/src/models/Share.js b/apps/files_sharing/src/models/Share.js
index 87c2fec86f2..5644ce0c2b3 100644
--- a/apps/files_sharing/src/models/Share.js
+++ b/apps/files_sharing/src/models/Share.js
@@ -359,6 +359,27 @@ export default class Share {
}
/**
+ * Password expiration time
+ *
+ * @return {string}
+ * @readonly
+ * @memberof Share
+ */
+ get passwordExpirationTime() {
+ return this._share.password_expiration_time
+ }
+
+ /**
+ * Password expiration time
+ *
+ * @param {string} password exipration time
+ * @memberof Share
+ */
+ set passwordExpirationTime(passwordExpirationTime) {
+ this._share.password_expiration_time = passwordExpirationTime
+ }
+
+ /**
* Password protection by Talk of the share
*
* @return {boolean}