confirm email on user registration improve

This commit is contained in:
knst-kotov
2022-06-09 13:52:56 +03:00
parent 9558a1afaa
commit 0cef013137
3 changed files with 19 additions and 11 deletions

View File

@@ -46,14 +46,9 @@ async def register(*_, email: str, password: str = ""):
session.add(user)
session.commit()
await UserStorage.add_user(user)
await send_confirm_email(user)
if not password:
await send_confirm_email(user)
return { "user": user }
token = await Authorize.authorize(user)
return {"user": user, "token": token }
return { "user": user }
@mutation.field("requestPasswordUpdate")
async def request_password_update(_, info, email):
@@ -95,6 +90,9 @@ async def login(_, info: GraphQLResolveInfo, email: str, password: str = ""):
await send_auth_email(orm_user)
return {}
if not orm_user.emailConfirmed:
return {"error" : "email not confirmed"}
try:
device = info.context["request"].headers['device']
except KeyError: