Browse Source

fix: requredEmail typo error and required & valid error should not show at the same time #2017

pull/7286/head
Ramesh Mane 11 months ago
parent
commit
300d0ea787
  1. 2
      packages/nc-gui/components/dlg/share-and-collaborate/Collaborate.vue
  2. 5
      packages/nc-gui/pages/forgot-password.vue
  3. 4
      packages/nc-gui/pages/signin.vue
  4. 3
      packages/nc-gui/pages/signup/[[token]].vue

2
packages/nc-gui/components/dlg/share-and-collaborate/Collaborate.vue

@ -13,7 +13,7 @@ const validators = computed(() => {
{ {
validator: (rule: any, value: string, callback: (errMsg?: string) => void) => { validator: (rule: any, value: string, callback: (errMsg?: string) => void) => {
if (!value || value.length === 0) { if (!value || value.length === 0) {
callback(t('msg.error.signUpRules.emailReqd')) callback(t('msg.error.signUpRules.emailRequired'))
return return
} }
const invalidEmails = (value || '').split(/\s*,\s*/).filter((e: string) => !validateEmail(e)) const invalidEmails = (value || '').split(/\s*,\s*/).filter((e: string) => !validateEmail(e))

5
packages/nc-gui/pages/forgot-password.vue

@ -23,12 +23,13 @@ const form = reactive({
const formRules = { const formRules = {
email: [ email: [
// E-mail is required // E-mail is required
{ required: true, message: t('msg.error.signUpRules.emailReqd') }, { required: true, message: t('msg.error.signUpRules.emailRequired') },
// E-mail must be valid format // E-mail must be valid format
{ {
validator: (_: unknown, v: string) => { validator: (_: unknown, v: string) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (validateEmail(v)) return resolve() if (!v?.length || validateEmail(v)) return resolve()
reject(new Error(t('msg.error.signUpRules.emailInvalid'))) reject(new Error(t('msg.error.signUpRules.emailInvalid')))
}) })
}, },

4
packages/nc-gui/pages/signin.vue

@ -38,12 +38,12 @@ const form = reactive({
const formRules: Record<string, RuleObject[]> = { const formRules: Record<string, RuleObject[]> = {
email: [ email: [
// E-mail is required // E-mail is required
{ required: true, message: t('msg.error.signUpRules.emailReqd') }, { required: true, message: t('msg.error.signUpRules.emailRequired') },
// E-mail must be valid format // E-mail must be valid format
{ {
validator: (_: unknown, v: string) => { validator: (_: unknown, v: string) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (validateEmail(v)) return resolve() if (!v?.length || validateEmail(v)) return resolve()
reject(new Error(t('msg.error.signUpRules.emailInvalid'))) reject(new Error(t('msg.error.signUpRules.emailInvalid')))
}) })

3
packages/nc-gui/pages/signup/[[token]].vue

@ -44,12 +44,13 @@ const form = reactive({
const formRules = { const formRules = {
email: [ email: [
// E-mail is required // E-mail is required
{ required: true, message: t('msg.error.signUpRules.emailReqd') }, { required: true, message: t('msg.error.signUpRules.emailRequired') },
// E-mail must be valid format // E-mail must be valid format
{ {
validator: (_: unknown, v: string) => { validator: (_: unknown, v: string) => {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!v?.length || validateEmail(v)) return resolve() if (!v?.length || validateEmail(v)) return resolve()
reject(new Error(t('msg.error.signUpRules.emailInvalid'))) reject(new Error(t('msg.error.signUpRules.emailInvalid')))
}) })
}, },

Loading…
Cancel
Save