Update layout, settings, and bulk upload password forcing

This commit is contained in:
2026-09-25 12:03:01 +05:30
parent e12c3fb8eb
commit ba4ab2049b
5 changed files with 144 additions and 10 deletions

View File

@@ -223,6 +223,8 @@ def change_password(payload: ChangePasswordRequest, session: Session = Depends(g
hashed_password = bcrypt.hashpw(payload.new_password.encode('utf-8'), bcrypt.gensalt()).decode('utf-8')
current_user.password_hash = hashed_password
if current_user.school == "BULK_REGISTERED":
current_user.school = None
session.add(current_user)
session.commit()
return {"success": True, "message": "Password updated successfully"}
@@ -273,6 +275,7 @@ async def bulk_register_students(file: UploadFile = File(...), session: Session
tier=tier,
student_class=models.ClassEnum.TWELFTH,
medium=models.MediumEnum.ENGLISH,
school="BULK_REGISTERED",
city="Unknown",
state="Unknown"
)
@@ -356,10 +359,8 @@ def register(payload: RegisterPayload, session: Session = Depends(get_session)):
student_class = class_map.get(payload.student_class or "12", models.ClassEnum.TWELFTH)
medium = medium_map.get(payload.medium or "English", models.MediumEnum.ENGLISH)
# Calculate trial_end based on admin settings
trial_end = None
if settings.enable_free_trial and settings.trial_duration_days > 0:
trial_end = datetime.utcnow() + timedelta(days=settings.trial_duration_days)
# Set trial_end directly to 15 days
trial_end = datetime.utcnow() + timedelta(days=15)
new_user = models.User(
name=payload.name,