token path param

This commit is contained in:
tonyrewin 2022-10-05 11:15:56 +03:00
parent d18424ed59
commit 5811e0e878
3 changed files with 2 additions and 4 deletions

View File

@ -11,9 +11,8 @@ async def send_auth_email(user, token):
Follow the <a href='%s'>link</link> to authorize
</body></html>
"""
url = "%s/confirm-email" % BACKEND_URL
to = "%s <%s>" % (user.username, user.email)
url_with_token = "%s?token=%s" % (url, token)
url_with_token = "%s/confirm-email/%s" % (BACKEND_URL, token)
text = text % url_with_token
response = requests.post(
MAILGUN_API_URL,

View File

@ -55,7 +55,7 @@ async def shutdown():
routes = [
Route("/oauth/{provider}", endpoint=oauth_login),
Route("/oauth_authorize", endpoint=oauth_authorize),
Route("/confirm-email", endpoint=confirm_email_handler), # should be called on client
Route("/confirm-email/{token}", endpoint=confirm_email_handler), # should be called on client
]
app = Starlette(

View File

@ -59,7 +59,6 @@ async def confirm_email(_, _info, confirm_token):
async def confirm_email_handler(request):
print(request)
token = request.path_params["token"] # one time
request.session["token"] = token
res = await confirm_email(None, token)