Gregniuki commited on
Commit
f2c4246
1 Parent(s): f75df02

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -1
main.py CHANGED
@@ -343,7 +343,9 @@ async def register_post(
343
 
344
  try:
345
  user = UserCreate(username=username, email=email, password=password, confirm_password=confirm_password)
346
- register(user, db) # If this function raises an HTTPException, it should be handled
 
 
347
  except HTTPException as e:
348
  # Return to the registration page with the error detail
349
  return templates.TemplateResponse("register.html", {
 
343
 
344
  try:
345
  user = UserCreate(username=username, email=email, password=password, confirm_password=confirm_password)
346
+ registered_user = register(user, db)
347
+ # If registration is successful, store user info in the session
348
+ request.session["user_info"] = {"username": registered_user.username, "email": registered_user.email}
349
  except HTTPException as e:
350
  # Return to the registration page with the error detail
351
  return templates.TemplateResponse("register.html", {