🔐 สร้างหน้า Login สำหรับระบบเช็คชื่อนักเรียนออนไลน์
📋 Requirements
สร้างหน้า Login ที่ใช้งานได้จริงสำหรับระบบเช็คชื่อนักเรียนออนไลน์ตามแบบที่ออกแบบไว้
🎯 Specifications
UI Design
- Layout: กึ่งกลางหน้าจอ, Bubble/Glass card design
- Font: Kanit, Prompt (Thai), Inter (English) - ขนาดใหญ่ Bold
- Colors: สีสดใส มีชีวิตชีวา
- Animation: Smooth transitions, Hover effects
- Responsive: มือถือ/แท็บเล็ต/PC
Login Form Fields
interface LoginForm {
schoolCode: string; // รหัสโรงเรียน
username: string; // ชื่อผู้ใช้/อีเมล
password: string; // รหัสผ่าน
rememberMe: boolean; // จำการเข้าสู่ระบบ
}
Features Required
Tech Stack
- Frontend: Next.js 14/15, React 18+, TypeScript
- UI: Tailwind CSS 4, Shadcn UI components
- Animation: Framer Motion (optional)
- Form: React Hook Form + Zod validation
- Auth: JWT tokens, localStorage/sessionStorage
🔄 Login Flow
- User enters school code → validate school exists
- User enters username → validate format
- User enters password → validate strength
- Click login → authenticate user
- Success → redirect to dashboard based on role
- Error → show appropriate error message
🎨 UI Layout Structure
┌─────────────────────────────┐
│ 🏫 [School Logo/Name] │
│ │
│ 📚 ระบบเช็คชื่อนักเรียน │
│ │
│ ┌─────────────────────┐ │
│ │ รหัสโรงเรียน │ │
│ └─────────────────────┘ │
│ │
│ ┌─────────────────────┐ │
│ │ ชื่อผู้ใช้/อีเมล │ │
│ └─────────────────────┘ │
│ │
│ ┌─────────────────────┐ │
│ │ รหัสผ่าน 👁️ │ │
│ └─────────────────────┘ │
│ │
│ ☐ จำการเข้าสู่ระบบ │
│ │
│ [ เข้าสู่ระบบ ] │
│ │
│ ลืมรหัสผ่าน? | สมัครใหม่ │
└─────────────────────────────┘
📱 Mobile UX Requirements
- Touch-friendly button sizes (min 44px)
- Proper keyboard types for inputs
- Smooth animations on focus/blur
- Error messages below each field
- Loading spinner on submit
🛡️ Security Features
- Password hashing (bcrypt)
- JWT token storage
- Input validation & sanitization
- CSRF protection
- Rate limiting for login attempts
🔧 Implementation Files Needed
app/login/page.tsx - Main login page
components/auth/LoginForm.tsx - Login form component
hooks/useAuth.ts - Authentication hook
lib/auth.ts - Authentication utilities
types/auth.ts - TypeScript interfaces
✅ Acceptance Criteria
🔐 สร้างหน้า Login สำหรับระบบเช็คชื่อนักเรียนออนไลน์
📋 Requirements
สร้างหน้า Login ที่ใช้งานได้จริงสำหรับระบบเช็คชื่อนักเรียนออนไลน์ตามแบบที่ออกแบบไว้
🎯 Specifications
UI Design
Login Form Fields
Features Required
Tech Stack
🔄 Login Flow
🎨 UI Layout Structure
📱 Mobile UX Requirements
🛡️ Security Features
🔧 Implementation Files Needed
app/login/page.tsx- Main login pagecomponents/auth/LoginForm.tsx- Login form componenthooks/useAuth.ts- Authentication hooklib/auth.ts- Authentication utilitiestypes/auth.ts- TypeScript interfaces✅ Acceptance Criteria