Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
session: Force _external on url_for()
Browse files Browse the repository at this point in the history
Looking at sanic-org/sanic#1731 this is “a
documentation issue”.
  • Loading branch information
PromyLOPh committed May 17, 2022
1 parent 0ed166c commit bf394bf
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bawwab/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,13 @@ async def sessionDelete (request):
return json ({}, status=200)

def callbackUrl (request):
kwargs = dict ()
# We have to use _external=True here, so sanic will use
# SERVER_NAME from the config to build a proper path. SERVER_NAME
# must contain the subpath at which this app is mounted at.
kwargs = dict (_external=True)
if 'next' in request.args:
kwargs['next'] = request.args['next'][0]
return request.url_for ('session.callback', **kwargs)
#return request.url_for ('session.callback')
return request.app.url_for ('session.callback', **kwargs)

@bp.route ('/login')
async def login (request):
Expand Down

0 comments on commit bf394bf

Please sign in to comment.