BUG: nginx 403
This commit is contained in:
parent
52770ee0e1
commit
73e7319c4e
|
@ -11,6 +11,8 @@ const index: RouteRecordRaw[] = [
|
||||||
{
|
{
|
||||||
name: 'KUN',
|
name: 'KUN',
|
||||||
path: '',
|
path: '',
|
||||||
|
// Try fix nginx slash
|
||||||
|
alias: '/',
|
||||||
component: () => import('@/views/Home/KUNGalgameMainPage.vue'),
|
component: () => import('@/views/Home/KUNGalgameMainPage.vue'),
|
||||||
meta: {
|
meta: {
|
||||||
title: 'home',
|
title: 'home',
|
||||||
|
|
|
@ -17,9 +17,9 @@ export const isValidName = (name: string) => {
|
||||||
return regex.test(name)
|
return regex.test(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regular expression to match a password of 6 to 17 characters, containing at least one letter and one number, and optionally including special characters \w!@#$%^&*()-+=
|
// Regular expression to match a password of 6 to 107 characters, containing at least one letter and one number, and optionally including special characters \w!@#$%^&*()-+=
|
||||||
export const isValidPassword = (pwd: string) => {
|
export const isValidPassword = (pwd: string) => {
|
||||||
const regex = /^(?=.*[a-zA-Z])(?=.*[0-9])[\w!@#$%^&*()-+=]{6,17}$/
|
const regex = /^(?=.*[a-zA-Z])(?=.*[0-9])[\w!@#$%^&*()-+=]{6,107}$/
|
||||||
return regex.test(pwd)
|
return regex.test(pwd)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,42 +41,6 @@ const registerForm = reactive<Record<string, string>>({
|
||||||
code: '',
|
code: '',
|
||||||
})
|
})
|
||||||
|
|
||||||
// Check if the form fields are empty
|
|
||||||
const isEmptyInput = () => {
|
|
||||||
if (!registerForm.name.trim()) {
|
|
||||||
Message('Username cannot be empty!', '用户名不可为空!', 'warn')
|
|
||||||
return false
|
|
||||||
} else if (!registerForm.email.trim()) {
|
|
||||||
Message('Email cannot be empty!', '邮箱不可为空!', 'warn')
|
|
||||||
return false
|
|
||||||
} else if (!registerForm.password.trim()) {
|
|
||||||
Message('Password cannot be empty!', '密码不可为空!', 'warn')
|
|
||||||
return false
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if the form fields are valid
|
|
||||||
const isValidInput = (): boolean => {
|
|
||||||
if (!isEmptyInput()) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (!isValidName(registerForm.name)) {
|
|
||||||
Message('Invalid username format!', '非法的用户名格式!', 'warn')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (!isValidEmail(registerForm.email)) {
|
|
||||||
Message('Invalid email format!', '非法的邮箱格式!', 'warn')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
if (!isValidPassword(registerForm.password)) {
|
|
||||||
Message('Invalid password format!', '非法的密码格式!', 'warn')
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send verification code
|
// Send verification code
|
||||||
const handleSendCode = () => {
|
const handleSendCode = () => {
|
||||||
// If the form is empty
|
// If the form is empty
|
||||||
|
@ -96,33 +60,6 @@ const handleSendCode = () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleRegister = async () => {
|
const handleRegister = async () => {
|
||||||
if (!isSendCode.value) {
|
|
||||||
Message(
|
|
||||||
'Need to send an email verification code',
|
|
||||||
'需要发送邮箱验证码',
|
|
||||||
'warn'
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!registerForm.code.trim()) {
|
|
||||||
Message(
|
|
||||||
'Email verification code cannot be empty',
|
|
||||||
'邮箱验证码不可为空',
|
|
||||||
'warn'
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isValidMailConfirmCode(registerForm.code)) {
|
|
||||||
Message(
|
|
||||||
'Invalid email verification code format!',
|
|
||||||
'非法的邮箱验证码格式!',
|
|
||||||
'warn'
|
|
||||||
)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Execute registration logic, send a request, and validate the code on the backend
|
// Execute registration logic, send a request, and validate the code on the backend
|
||||||
const res = await useKUNGalgameUserStore().register({
|
const res = await useKUNGalgameUserStore().register({
|
||||||
name: registerForm.name,
|
name: registerForm.name,
|
||||||
|
|
0
src/views/login/utils/checkLogin.ts
Normal file
0
src/views/login/utils/checkLogin.ts
Normal file
71
src/views/login/utils/checkRegister.ts
Normal file
71
src/views/login/utils/checkRegister.ts
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
import Message from '@/components/alert/Message'
|
||||||
|
import {
|
||||||
|
isValidEmail,
|
||||||
|
isValidName,
|
||||||
|
isValidPassword,
|
||||||
|
isValidMailConfirmCode,
|
||||||
|
} from '@/utils/validate'
|
||||||
|
import i18n from '@/language/i18n'
|
||||||
|
|
||||||
|
// Check if the form fields are valid
|
||||||
|
export const checkRegisterForm = (
|
||||||
|
name: string,
|
||||||
|
email: string,
|
||||||
|
password: string
|
||||||
|
): boolean => {
|
||||||
|
if (!name.trim() || !email.trim() || !password.trim()) {
|
||||||
|
Message(
|
||||||
|
'Username, email, password field cannot be empty!',
|
||||||
|
'用户名,邮箱,密码字段不可为空!',
|
||||||
|
'warn'
|
||||||
|
)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isValidName(name)) {
|
||||||
|
Message('Invalid username format!', '非法的用户名格式!', 'warn')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isValidEmail(email)) {
|
||||||
|
Message('Invalid email format!', '非法的邮箱格式!', 'warn')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isValidPassword(password)) {
|
||||||
|
Message('Invalid password format!', '非法的密码格式!', 'warn')
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if the form fields are valid, on submit register form
|
||||||
|
export const checkRegisterFormSubmit = (isSendCode: boolean, code: string) => {
|
||||||
|
if (!isSendCode) {
|
||||||
|
Message(
|
||||||
|
'Need to send an email verification code',
|
||||||
|
'需要发送邮箱验证码',
|
||||||
|
'warn'
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!code.trim()) {
|
||||||
|
Message(
|
||||||
|
'Email verification code cannot be empty',
|
||||||
|
'邮箱验证码不可为空',
|
||||||
|
'warn'
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!isValidMailConfirmCode(code)) {
|
||||||
|
Message(
|
||||||
|
'Invalid email verification code format!',
|
||||||
|
'非法的邮箱验证码格式!',
|
||||||
|
'warn'
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue