Gregniuki commited on
Commit
b5d2082
1 Parent(s): 2bec88d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -292,9 +292,13 @@ async def register_post(
292
  # Create an access token
293
  access_token = create_access_token(data={"sub": registered_user.email})
294
  # Redirect to the protected route
295
- response = RedirectResponse(url="/protected")
 
296
  response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
297
  return response
 
 
 
298
  except HTTPException as e:
299
  return templates.TemplateResponse("register.html", {"request": request, "error_message": e.detail})
300
 
 
292
  # Create an access token
293
  access_token = create_access_token(data={"sub": registered_user.email})
294
  # Redirect to the protected route
295
+ url = app.url_path_for("get_protected")
296
+ response = RedirectResponse(url, status_code=status.HTTP_303_SEE_OTHER)
297
  response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
298
  return response
299
+ # response = RedirectResponse(url="/protected")
300
+ # response.set_cookie(key="access_token", value=f"Bearer {access_token}", httponly=True)
301
+ # return response
302
  except HTTPException as e:
303
  return templates.TemplateResponse("register.html", {"request": request, "error_message": e.detail})
304