Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: reset password input for internal links #10159

Merged
merged 1 commit into from
Dec 13, 2023
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
2 changes: 2 additions & 0 deletions changelog/unreleased/enhancement-create-link-modal
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ When creating a link while passwords are enfoced, Web will now display a modal t

https://github.com/owncloud/web/pull/10104
https://github.com/owncloud/web/pull/10145
https://github.com/owncloud/web/pull/10159
https://github.com/owncloud/web/issues/10157
8 changes: 8 additions & 0 deletions packages/web-pkg/src/components/CreateLinkModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<div>
<oc-text-input
v-if="!onlyInternalLinksAllowed"
:key="passwordInputKey"
:model-value="password.value"
type="password"
:password-policy="passwordPolicy"
Expand Down Expand Up @@ -136,6 +137,7 @@

<script lang="ts">
import { DateTime } from 'luxon'
import { v4 as uuidV4 } from 'uuid'
import { useGettext } from 'vue3-gettext'
import {
computed,
Expand Down Expand Up @@ -207,6 +209,7 @@ export default defineComponent({

const isFolder = computed(() => props.resources.every(({ isFolder }) => isFolder))

const passwordInputKey = ref(uuidV4())
const roleRefs = ref<Record<string, ComponentPublicInstance>>({})

const password = reactive({ value: '', error: undefined })
Expand Down Expand Up @@ -348,7 +351,11 @@ export default defineComponent({
selectedRole.value = role
if (unref(selectedRoleIsInternal)) {
password.value = ''
password.error = ''
selectedExpiry.value = undefined

// re-render password because it's the only way to remove policy messages
passwordInputKey.value = uuidV4()
}
}

Expand All @@ -369,6 +376,7 @@ export default defineComponent({
passwordEnforced,
passwordPolicy,
generatePasswordMethod: () => passwordPolicyService.generatePassword(),
passwordInputKey,
selectedExpiry,
expirationDateTooltip,
expirationRules,
Expand Down