initial
This commit is contained in:
24
apps/client/plugins/validation-rules.js
Normal file
24
apps/client/plugins/validation-rules.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import { defineRule } from 'vee-validate'
|
||||
import { defineNuxtPlugin } from '#app'
|
||||
|
||||
export default defineNuxtPlugin((nuxtApp) => {
|
||||
const { t } = nuxtApp.$i18n
|
||||
|
||||
defineRule('password', (value) => {
|
||||
if (value.length < 8)
|
||||
return t('validation.password')
|
||||
|
||||
const uppercaseRegex = /[A-Z]/
|
||||
const digitRegex = /\d/
|
||||
const specialCharRegex = /[!@#$%^&*()_+\-=\[\]{};':"\\|,.<>\/?]/
|
||||
|
||||
if (
|
||||
!uppercaseRegex.test(value)
|
||||
|| !digitRegex.test(value)
|
||||
|| !specialCharRegex.test(value)
|
||||
)
|
||||
return t('validation.password')
|
||||
|
||||
return true
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user