Browse Source

fix/Improved email and password validation of signup page

pull/3223/head
Muhammed Mustafa 2 years ago
parent
commit
e5abad23f6
  1. 15
      packages/nc-gui-v2/pages/signup/[[token]].vue

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

@ -1,4 +1,5 @@
<script setup lang="ts">
import { validatePassword } from 'nocodb-sdk'
import {
definePageMeta,
extractSdkResponseErrorMsg,
@ -43,7 +44,7 @@ const formRules = {
{
validator: (_: unknown, v: string) => {
return new Promise((resolve, reject) => {
if (isEmail(v)) return resolve(true)
if (!v?.length || isEmail(v)) return resolve(true)
reject(new Error(t('msg.error.signUpRules.emailInvalid')))
})
},
@ -51,9 +52,15 @@ const formRules = {
},
],
password: [
// Password is required
{ required: true, message: t('msg.error.signUpRules.passwdRequired') },
{ min: 8, message: t('msg.error.signUpRules.passwdLength') },
{
validator: (_: unknown, v: string) => {
return new Promise((resolve, reject) => {
const { error, valid } = validatePassword(v)
if (valid) return resolve(true)
reject(new Error(error))
})
},
},
],
}

Loading…
Cancel
Save