This commit is contained in:
aaron 2026-04-27 15:26:50 +08:00
parent b5f277500f
commit cd80ae04ec

View File

@ -4,6 +4,7 @@ from sqlalchemy import select, func
from sqlalchemy.orm import selectinload
from sqlalchemy.ext.asyncio import AsyncSession
from app.core.auth import hash_password
from app.db.models import ClassMembership, Class_, User
@ -85,7 +86,8 @@ async def import_members(
placeholder_email = f"inactive+{class_id}.{sid}@member.local"
new_user = User(
email=placeholder_email,
password_hash=None,
# Keep inactive imports compatible with older schemas where password_hash is NOT NULL.
password_hash=hash_password(secrets.token_urlsafe(24)),
name=name,
student_id=sid,
role="student",