"frontend/git@web.lueluesay.top:chenxi/sub2api.git" did not exist on "de18bce9aa795a295dbc6f9c86ddd82ece2f9cb8"
Commit c86d445c authored by IanShaw027's avatar IanShaw027
Browse files

fix(frontend): sync with main and finalize i18n & component optimizations

parents 6c036d7b e78c8646
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
: 'badge-danger' : 'badge-danger'
]" ]"
> >
{{ t('admin.redeem.statuses.' + value) }} {{ t('admin.redeem.status.' + value) }}
</span> </span>
</template> </template>
......
...@@ -240,7 +240,7 @@ ...@@ -240,7 +240,7 @@
href="https://dash.cloudflare.com/" href="https://dash.cloudflare.com/"
target="_blank" target="_blank"
class="text-primary-600 hover:text-primary-500" class="text-primary-600 hover:text-primary-500"
>Cloudflare Dashboard</a >{{ t('admin.settings.turnstile.cloudflareDashboard') }}</a
> >
</p> </p>
</div> </div>
......
...@@ -295,12 +295,12 @@ function onTurnstileVerify(token: string): void { ...@@ -295,12 +295,12 @@ function onTurnstileVerify(token: string): void {
function onTurnstileExpire(): void { function onTurnstileExpire(): void {
turnstileToken.value = '' turnstileToken.value = ''
errors.turnstile = 'Verification expired, please try again' errors.turnstile = t('auth.turnstileExpired')
} }
function onTurnstileError(): void { function onTurnstileError(): void {
turnstileToken.value = '' turnstileToken.value = ''
errors.turnstile = 'Verification failed, please try again' errors.turnstile = t('auth.turnstileFailed')
} }
// ==================== Validation ==================== // ==================== Validation ====================
...@@ -315,25 +315,25 @@ function validateForm(): boolean { ...@@ -315,25 +315,25 @@ function validateForm(): boolean {
// Email validation // Email validation
if (!formData.email.trim()) { if (!formData.email.trim()) {
errors.email = 'Email is required' errors.email = t('auth.emailRequired')
isValid = false isValid = false
} else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) { } else if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(formData.email)) {
errors.email = 'Please enter a valid email address' errors.email = t('auth.invalidEmail')
isValid = false isValid = false
} }
// Password validation // Password validation
if (!formData.password) { if (!formData.password) {
errors.password = 'Password is required' errors.password = t('auth.passwordRequired')
isValid = false isValid = false
} else if (formData.password.length < 6) { } else if (formData.password.length < 6) {
errors.password = 'Password must be at least 6 characters' errors.password = t('auth.passwordMinLength')
isValid = false isValid = false
} }
// Turnstile validation // Turnstile validation
if (turnstileEnabled.value && !turnstileToken.value) { if (turnstileEnabled.value && !turnstileToken.value) {
errors.turnstile = 'Please complete the verification' errors.turnstile = t('auth.completeVerification')
isValid = false isValid = false
} }
...@@ -362,7 +362,7 @@ async function handleLogin(): Promise<void> { ...@@ -362,7 +362,7 @@ async function handleLogin(): Promise<void> {
}) })
// Show success toast // Show success toast
appStore.showSuccess('Login successful! Welcome back.') appStore.showSuccess(t('auth.loginSuccess'))
// Redirect to dashboard or intended route // Redirect to dashboard or intended route
const redirectTo = (router.currentRoute.value.query.redirect as string) || '/dashboard' const redirectTo = (router.currentRoute.value.query.redirect as string) || '/dashboard'
...@@ -382,7 +382,7 @@ async function handleLogin(): Promise<void> { ...@@ -382,7 +382,7 @@ async function handleLogin(): Promise<void> {
} else if (err.message) { } else if (err.message) {
errorMessage.value = err.message errorMessage.value = err.message
} else { } else {
errorMessage.value = 'Login failed. Please check your credentials and try again.' errorMessage.value = t('auth.loginFailed')
} }
// Also show error toast // Also show error toast
......
...@@ -340,12 +340,12 @@ function onTurnstileVerify(token: string): void { ...@@ -340,12 +340,12 @@ function onTurnstileVerify(token: string): void {
function onTurnstileExpire(): void { function onTurnstileExpire(): void {
turnstileToken.value = '' turnstileToken.value = ''
errors.turnstile = 'Verification expired, please try again' errors.turnstile = t('auth.turnstileExpired')
} }
function onTurnstileError(): void { function onTurnstileError(): void {
turnstileToken.value = '' turnstileToken.value = ''
errors.turnstile = 'Verification failed, please try again' errors.turnstile = t('auth.turnstileFailed')
} }
// ==================== Validation ==================== // ==================== Validation ====================
...@@ -365,25 +365,25 @@ function validateForm(): boolean { ...@@ -365,25 +365,25 @@ function validateForm(): boolean {
// Email validation // Email validation
if (!formData.email.trim()) { if (!formData.email.trim()) {
errors.email = 'Email is required' errors.email = t('auth.emailRequired')
isValid = false isValid = false
} else if (!validateEmail(formData.email)) { } else if (!validateEmail(formData.email)) {
errors.email = 'Please enter a valid email address' errors.email = t('auth.invalidEmail')
isValid = false isValid = false
} }
// Password validation // Password validation
if (!formData.password) { if (!formData.password) {
errors.password = 'Password is required' errors.password = t('auth.passwordRequired')
isValid = false isValid = false
} else if (formData.password.length < 6) { } else if (formData.password.length < 6) {
errors.password = 'Password must be at least 6 characters' errors.password = t('auth.passwordMinLength')
isValid = false isValid = false
} }
// Turnstile validation // Turnstile validation
if (turnstileEnabled.value && !turnstileToken.value) { if (turnstileEnabled.value && !turnstileToken.value) {
errors.turnstile = 'Please complete the verification' errors.turnstile = t('auth.completeVerification')
isValid = false isValid = false
} }
...@@ -429,7 +429,7 @@ async function handleRegister(): Promise<void> { ...@@ -429,7 +429,7 @@ async function handleRegister(): Promise<void> {
}) })
// Show success toast // Show success toast
appStore.showSuccess('Account created successfully! Welcome to ' + siteName.value + '.') appStore.showSuccess(t('auth.accountCreatedSuccess', { siteName: siteName.value }))
// Redirect to dashboard // Redirect to dashboard
await router.push('/dashboard') await router.push('/dashboard')
...@@ -448,7 +448,7 @@ async function handleRegister(): Promise<void> { ...@@ -448,7 +448,7 @@ async function handleRegister(): Promise<void> {
} else if (err.message) { } else if (err.message) {
errorMessage.value = err.message errorMessage.value = err.message
} else { } else {
errorMessage.value = 'Registration failed. Please try again.' errorMessage.value = t('auth.registrationFailed')
} }
// Also show error toast // Also show error toast
......
...@@ -500,7 +500,7 @@ const getHistoryItemTitle = (item: RedeemHistoryItem) => { ...@@ -500,7 +500,7 @@ const getHistoryItemTitle = (item: RedeemHistoryItem) => {
} else if (item.type === 'subscription') { } else if (item.type === 'subscription') {
return t('redeem.subscriptionAssigned') return t('redeem.subscriptionAssigned')
} }
return 'Unknown' return t('common.unknown')
} }
const formatHistoryValue = (item: RedeemHistoryItem) => { const formatHistoryValue = (item: RedeemHistoryItem) => {
......
...@@ -279,7 +279,7 @@ async function loadSubscriptions() { ...@@ -279,7 +279,7 @@ async function loadSubscriptions() {
subscriptions.value = await subscriptionsAPI.getMySubscriptions() subscriptions.value = await subscriptionsAPI.getMySubscriptions()
} catch (error) { } catch (error) {
console.error('Failed to load subscriptions:', error) console.error('Failed to load subscriptions:', error)
appStore.showError('Failed to load subscriptions') appStore.showError(t('userSubscriptions.failedToLoad'))
} finally { } finally {
loading.value = false loading.value = false
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment