Spaces:
Running
Running
Download frontend/src/features/admin-console/schemas/adminSchema.ts from Shadowfilebot/Bot: direct link, hf CLI and curl.
- Browser
- Download file 717 Bytes
-
https://huggingface.co/spaces/Shadowfilebot/Bot/resolve/main/frontend/src/features/admin-console/schemas/adminSchema.ts
- Command line
-
hf download hf://spaces/Shadowfilebot/Bot/frontend/src/features/admin-console/schemas/adminSchema.ts
-
curl -L -o adminSchema.ts https://huggingface.co/spaces/Shadowfilebot/Bot/resolve/main/frontend/src/features/admin-console/schemas/adminSchema.ts
717 Bytes
| import { requiredText, ValidationResult } from '@/shared/lib/validation'; | |
| export function validatePasswordChange( | |
| currentPassword: string, | |
| newPassword: string, | |
| confirmPassword: string, | |
| ): ValidationResult<{ currentPassword: string; newPassword: string }> { | |
| const curErr = requiredText(currentPassword, 'Mật khẩu hiện tại', 1, 200); | |
| if (curErr) return { ok: false, error: curErr }; | |
| const newErr = requiredText(newPassword, 'Mật khẩu mới', 6, 200); | |
| if (newErr) return { ok: false, error: newErr }; | |
| if (newPassword !== confirmPassword) { | |
| return { ok: false, error: 'Xác nhận mật khẩu mới không khớp.' }; | |
| } | |
| return { ok: true, data: { currentPassword, newPassword } }; | |
| } | |