mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
fix(files_sharing): improve file request email handling
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This commit is contained in:
parent
eb2cda13c8
commit
55d41941bc
3 changed files with 19 additions and 9 deletions
|
|
@ -212,7 +212,7 @@ export default defineComponent({
|
|||
if (this.emails.length === 0) {
|
||||
return t('files_sharing', 'Close')
|
||||
}
|
||||
return n('files_sharing', 'Close and send email', 'Close and send {count} emails', this.emails.length, { count: this.emails.length })
|
||||
return n('files_sharing', 'Send email and close', 'Send {count} emails and close', this.emails.length, { count: this.emails.length })
|
||||
},
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
<!-- Expiration date -->
|
||||
<fieldset class="file-request-dialog__expiration" data-cy-file-request-dialog-fieldset="expiration">
|
||||
<NcNoteCard v-if="defaultExpireDateEnforced" type="info">
|
||||
{{ t('files_sharing', 'Your administrator has enforced a default expiration date with a maximum {days} days.', { days: defaultExpireDate }) }}
|
||||
{{ t('files_sharing', 'Your administrator has enforced a default expiration date with a maximum of {days} days.', { days: defaultExpireDate }) }}
|
||||
</NcNoteCard>
|
||||
|
||||
<!-- Enable expiration -->
|
||||
|
|
@ -22,7 +22,7 @@
|
|||
:checked="defaultExpireDateEnforced || expirationDate !== null"
|
||||
:disabled="disabled || defaultExpireDateEnforced"
|
||||
@update:checked="onToggleDeadline">
|
||||
{{ t('files_sharing', 'Set a submission expirationDate') }}
|
||||
{{ t('files_sharing', 'Set a submission expiration date') }}
|
||||
</NcCheckboxRadioSwitch>
|
||||
|
||||
<!-- Date picker -->
|
||||
|
|
|
|||
|
|
@ -45,9 +45,10 @@
|
|||
<template #icon>
|
||||
<NcAvatar :disable-menu="true"
|
||||
:disable-tooltip="true"
|
||||
:is-guest="true"
|
||||
:size="24"
|
||||
:user="mail" />
|
||||
:display-name="mail"
|
||||
:is-no-user="true"
|
||||
:show-user-status="false"
|
||||
:size="24" />
|
||||
</template>
|
||||
</NcChip>
|
||||
</div>
|
||||
|
|
@ -147,7 +148,15 @@ export default defineComponent({
|
|||
},
|
||||
|
||||
addNewEmail(e: KeyboardEvent) {
|
||||
if (this.email.trim() === '') {
|
||||
return
|
||||
}
|
||||
|
||||
if (e.target instanceof HTMLInputElement) {
|
||||
// Reset the custom validity
|
||||
e.target.setCustomValidity('')
|
||||
|
||||
// Check if the field is valid
|
||||
if (e.target.checkValidity() === false) {
|
||||
e.target.reportValidity()
|
||||
return
|
||||
|
|
@ -160,6 +169,7 @@ export default defineComponent({
|
|||
return
|
||||
}
|
||||
|
||||
// Check if the email is valid
|
||||
if (!this.isValidEmail(this.email.trim())) {
|
||||
e.target.setCustomValidity(t('files_sharing', 'Invalid email address'))
|
||||
e.target.reportValidity()
|
||||
|
|
@ -203,9 +213,9 @@ export default defineComponent({
|
|||
this.email = ''
|
||||
},
|
||||
|
||||
isValidEmail(email) {
|
||||
const regExpEmail = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/
|
||||
return regExpEmail.test(email)
|
||||
// No need to have a fancy regex, just check for an @
|
||||
isValidEmail(email: string): boolean {
|
||||
return email.includes('@')
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue