fix(web): frontend quality — XSS, error states, a11y, image optimization, security headers
- Whitelist OAuth error codes; never render raw URL params (XSS fix) - Add error state UI with retry button for API failures on homepage and search - Use <article> for property cards with ARIA labels and semantic list markup - Replace raw <img> with Next.js <Image> across all listing/gallery/KYC pages - Add security headers (X-Content-Type-Options, X-Frame-Options, etc.) in next.config.js - Gate console.error behind NODE_ENV check in global error boundary - Mapbox confirmed npm-bundled (SRI N/A) Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -22,12 +22,16 @@ export default function LoginPage() {
|
||||
const [showPassword, setShowPassword] = useState(false);
|
||||
|
||||
const oauthError = searchParams.get('error');
|
||||
const oauthErrorMessage =
|
||||
oauthError === 'oauth_failed'
|
||||
? 'Đăng nhập bằng mạng xã hội thất bại. Vui lòng thử lại.'
|
||||
: oauthError
|
||||
? decodeURIComponent(oauthError)
|
||||
: null;
|
||||
const OAUTH_ERROR_MESSAGES: Record<string, string> = {
|
||||
oauth_failed: 'Đăng nhập bằng mạng xã hội thất bại. Vui lòng thử lại.',
|
||||
access_denied: 'Bạn đã từ chối quyền truy cập. Vui lòng thử lại.',
|
||||
invalid_request: 'Yêu cầu đăng nhập không hợp lệ. Vui lòng thử lại.',
|
||||
server_error: 'Lỗi máy chủ. Vui lòng thử lại sau.',
|
||||
temporarily_unavailable: 'Dịch vụ tạm thời không khả dụng. Vui lòng thử lại sau.',
|
||||
};
|
||||
const oauthErrorMessage = oauthError
|
||||
? OAUTH_ERROR_MESSAGES[oauthError] ?? 'Đã xảy ra lỗi khi đăng nhập. Vui lòng thử lại.'
|
||||
: null;
|
||||
|
||||
const {
|
||||
register,
|
||||
|
||||
Reference in New Issue
Block a user