import { useState, useEffect } from 'react'; import { useAuth } from '../auth/AuthContext'; import { useGitHubConnection } from '../hooks/useGitHubConnection'; import { GitHubReposPanel } from './GitHubReposPanel'; import { OrganizationSection } from './OrganizationSection'; import { apiQldt } from '../api'; export function ChangePasswordPage({ forced }: { forced?: boolean }) { const { changePassword, logout } = useAuth(); const [oldPassword, setOldPassword] = useState(''); const [newPassword, setNewPassword] = useState(''); const [confirm, setConfirm] = useState(''); const [error, setError] = useState(''); const [busy, setBusy] = useState(false); const submit = async (e: React.FormEvent) => { e.preventDefault(); setError(''); if (newPassword.length < 8) { setError('Mật khẩu mới tối thiểu 8 ký tự'); return; } if (newPassword !== confirm) { setError('Xác nhận mật khẩu không khớp'); return; } setBusy(true); try { await changePassword(oldPassword, newPassword); } catch (err: any) { setError(err?.message || 'Đổi mật khẩu thất bại'); } finally { setBusy(false); } }; return (
Lần đăng nhập đầu tiên — vui lòng đặt mật khẩu mới trước khi tiếp tục.
}Thông tin đăng nhập, GitHub và bảo mật cá nhân.
{displayName}
{staff?.email}
Kết nối tài khoản GitHub của bạn để đẩy bài nộp phòng thi lên repo riêng. Mỗi giáo viên dùng GitHub của mình — không dùng chung token server.
Sau khi kết nối, vào Phòng thi → tab Bài nộp → đẩy Git (gộp hoặc từng sinh viên).
)} {gh.connected && ( <>Cấu hình token đồng bộ dữ liệu lớp học, môn học và điểm danh từ Cổng đào tạo (QLĐT).
{loadingQldt ? (Đang tải cấu hình...
) : ( )}