Files
Kotyata/apps/client/plugins/validation-rules.js
2026-03-17 13:24:22 +03:00

25 lines
581 B
JavaScript

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
})
})