Update main.py
Browse files
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)
|
|
|
|
|
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", {
|