Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
:label="t('files_sharing', 'Enter a password')"
:disabled="saving"
:required="config.enableLinkPasswordByDefault || config.enforcePasswordForPublicLink"
:minlength="isPasswordPolicyEnabled && config.passwordPolicy.minLength"
:minlength="minPasswordLength"
autocomplete="new-password"
@submit="onNewLinkShare(true)">
<template #icon>
Expand Down Expand Up @@ -349,6 +349,16 @@ export default {
},

computed: {
minPasswordLength() {
if (this.isPasswordPolicyEnabled) {
if (this.config.passwordPolicy.policies?.sharing?.minLength) {
return this.config.passwordPolicy.policies.sharing.minLength
}
return this.config.passwordPolicy.minLength
}
return 0
},

/**
* Link share label
*
Expand Down
12 changes: 11 additions & 1 deletion apps/files_sharing/src/services/ConfigService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@
import { getCapabilities } from '@nextcloud/capabilities'
import { loadState } from '@nextcloud/initial-state'

type PasswordPolicyCapabilities = {
type PasswordPolicySettings = {
enforceNonCommonPassword: boolean
enforceNumericCharacters: boolean
enforceSpecialCharacters: boolean
enforceUpperLowerCase: boolean
minLength: number
}

type PasswordPolicyCapabilities = PasswordPolicySettings & {
api?: {
generate: string
validate: string
}
policies?: {
sharing: PasswordPolicySettings
}
}

type FileSharingCapabilities = {
api_enabled: boolean
public: {
Expand Down
4 changes: 3 additions & 1 deletion apps/files_sharing/src/utils/GeneratePassword.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ export default async function(verbose = false): Promise<string> {
// password policy is enabled, let's request a pass
if (config.passwordPolicy.api && config.passwordPolicy.api.generate) {
try {
const request = await axios.get(config.passwordPolicy.api.generate)
const request = await axios.get(config.passwordPolicy.api.generate, {
params: { context: 'sharing' },
})
if (request.data.ocs.data.password) {
if (verbose) {
showSuccess(t('files_sharing', 'Password created successfully'))
Expand Down
4 changes: 2 additions & 2 deletions dist/2373-2373.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/2373-2373.js.map

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions dist/2577-2577.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/2577-2577.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/2577-2577.js.map.license
2 changes: 0 additions & 2 deletions dist/8930-8930.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/8930-8930.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/8930-8930.js.map.license

This file was deleted.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-init.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files_sharing-init.js.map

Large diffs are not rendered by default.

Loading