deckhearth/pages/api/test-auth.js
Randall Stillwell e75a4a6649 Major redesign: Enhanced card display with particle effects, improved filters, and search functionality
- Redesigned card display with 2.5:3.5 aspect ratio and image-only view
- Added infinite scroll to replace pagination
- Implemented authentic card back placeholders for MTG, Pokemon, and Lorcana
- Added rarity-based particle effects with tiered intensity (mythic/enchanted/rare/uncommon)
- Enhanced hover details panel with structured card information
- Fixed search functionality with debouncing and Enter key support
- Improved filter system with working TCG, rarity, set, and price filters
- Added favorite system for cards in both hover and detail views
- Updated card detail page with comprehensive metadata and actions
- Fixed API filtering with proper Vercel Postgres implementation
- Added particle animations and rarity glow effects
- Improved overall UX with better visual hierarchy and interactions
2025-07-23 21:26:54 -05:00

51 lines
No EOL
1.3 KiB
JavaScript

import { hashPassword, verifyPassword, generateToken } from './auth-utils.js';
export default async function handler(req, res) {
// Set CORS headers
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
// Handle preflight requests
if (req.method === 'OPTIONS') {
res.status(200).end();
return;
}
try {
// Test password hashing
const password = 'test123';
const hashedPassword = await hashPassword(password);
const isValid = await verifyPassword(password, hashedPassword);
// Test token generation
const user = {
id: 1,
email: 'test@example.com',
role: 'user'
};
const token = generateToken(user);
res.status(200).json({
success: true,
message: 'Authentication utilities working!',
passwordTest: {
original: password,
hashed: hashedPassword,
isValid
},
tokenTest: {
token,
user
},
timestamp: new Date().toISOString()
});
} catch (error) {
console.error('Auth test error:', error);
res.status(500).json({
error: 'Authentication test failed',
details: error.message
});
}
}