Skip to content
Open
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
37 changes: 36 additions & 1 deletion apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,16 @@
<NcDateTimePickerNative
v-if="hasExpirationDate"
id="share-date-picker"
ref="expireDate"
:model-value="new Date(share.expireDate ?? dateTomorrow)"
:min="dateTomorrow"
:max="maxExpirationDateEnforced"
hide-label
:label="t('files_sharing', 'Expiration date')"
:placeholder="t('files_sharing', 'Expiration date')"
type="date"
@input="onExpirationChange" />
@update:model-value="onExpirationChange"
@change="checkExpirationDateValidity" />
<NcCheckboxRadioSwitch
v-if="isPublicShare"
v-model="share.hideDownload"
Expand Down Expand Up @@ -895,6 +897,32 @@ export default {
},

methods: {
/**
* Check native `min` / `max` constraints on the expiration date field.
* Prefer the change event target when available (same pattern as SharingEntryLink).
*
* @param {Event} [event]
* @return {boolean}
*/
checkExpirationDateValidity(event) {
const fromEvent = event?.target
const fromRef = this.$refs.expireDate?.$el?.querySelector?.('input')
const input = fromEvent instanceof HTMLInputElement
? fromEvent
: (fromRef instanceof HTMLInputElement ? fromRef : null)

if (!input) {
return true
}

input.setCustomValidity('')
const isValid = input.checkValidity()
if (!isValid) {
input.reportValidity()
}
return isValid
},

/**
* Set a share attribute on the current share
*
Expand Down Expand Up @@ -1137,6 +1165,8 @@ export default {

if (!this.hasExpirationDate) {
this.share.expireDate = ''
} else if (!this.checkExpirationDateValidity()) {
return
}

if (this.isNewShare) {
Expand Down Expand Up @@ -1469,4 +1499,9 @@ export default {
}
}
}

:deep(input:user-invalid) {
--input-border-color: var(--color-border-error, var(--color-error)) !important;
border-color: var(--color-border-error, var(--color-error)) !important;
}
</style>
4 changes: 3 additions & 1 deletion apps/settings/src/components/Users/UserFormFields.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
autocomplete="off"
spellcheck="false"
pattern="[a-zA-Z0-9 _\.@\-']+"
:required="fieldConfig.username?.required" />
:required="fieldConfig.username?.required"
@input="updateUsernameValidity"
@blur="updateUsernameValidity" />

<NcTextField
v-model="formData.displayName"
Expand Down
6 changes: 5 additions & 1 deletion core/src/components/login/LoginForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
:spellchecking="false"
:autocomplete="autoCompleteAllowed ? 'username' : 'off'"
required
:error="userNameInputLengthIs255"
:error="userNameError"
:helper-text="userInputHelperText"
data-login-form-input-user
@change="updateUsername" />
Expand Down Expand Up @@ -241,6 +241,10 @@ export default {
|| this.throttleDelay > 5000
},

userNameError() {
return this.isError || this.userNameInputLengthIs255
},

errorLabel() {
if (this.invalidPassword) {
return t('core', 'Wrong login or password.')
Expand Down
12 changes: 12 additions & 0 deletions core/src/tests/components/Login/LoginForm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ describe('core: LoginForm', () => {
expect(input.value).toBe('test-user')
})

it('marks username field as error when login credentials are invalid', () => {
const page = render(LoginForm, {
props: {
errors: ['invalidpassword'],
username: 'wrong-user',
},
})

const input = page.getByRole('textbox', { name: /Account name or email/ })
expect(input.closest('.input-field--error')).not.toBeNull()
})

describe('', () => {
beforeAll(() => {
vi.useFakeTimers()
Expand Down
2 changes: 0 additions & 2 deletions dist/1458-1458.js

This file was deleted.

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

This file was deleted.

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

This file was deleted.

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

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/5482-5482.js.map.license
4 changes: 2 additions & 2 deletions dist/core-login.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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/settings-vue-settings-admin-ai.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-admin-ai.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/settings-vue-settings-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-users-management.js.map

Large diffs are not rendered by default.

Loading
Loading