token path param
This commit is contained in:
parent
d18424ed59
commit
5811e0e878
|
@ -11,9 +11,8 @@ async def send_auth_email(user, token):
|
||||||
Follow the <a href='%s'>link</link> to authorize
|
Follow the <a href='%s'>link</link> to authorize
|
||||||
</body></html>
|
</body></html>
|
||||||
"""
|
"""
|
||||||
url = "%s/confirm-email" % BACKEND_URL
|
|
||||||
to = "%s <%s>" % (user.username, user.email)
|
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
|
text = text % url_with_token
|
||||||
response = requests.post(
|
response = requests.post(
|
||||||
MAILGUN_API_URL,
|
MAILGUN_API_URL,
|
||||||
|
|
2
main.py
2
main.py
|
@ -55,7 +55,7 @@ async def shutdown():
|
||||||
routes = [
|
routes = [
|
||||||
Route("/oauth/{provider}", endpoint=oauth_login),
|
Route("/oauth/{provider}", endpoint=oauth_login),
|
||||||
Route("/oauth_authorize", endpoint=oauth_authorize),
|
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(
|
app = Starlette(
|
||||||
|
|
|
@ -59,7 +59,6 @@ async def confirm_email(_, _info, confirm_token):
|
||||||
|
|
||||||
|
|
||||||
async def confirm_email_handler(request):
|
async def confirm_email_handler(request):
|
||||||
print(request)
|
|
||||||
token = request.path_params["token"] # one time
|
token = request.path_params["token"] # one time
|
||||||
request.session["token"] = token
|
request.session["token"] = token
|
||||||
res = await confirm_email(None, token)
|
res = await confirm_email(None, token)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user