Added email-verification

This commit is contained in:
Mawoka
2022-03-05 15:48:07 +01:00
parent bd00612401
commit df5f73a1d8
6 changed files with 80 additions and 38 deletions
+3 -3
View File
@@ -12,14 +12,14 @@ async def cache_account(criteria: str, content: str) -> Union[User, None]:
if criteria == "email":
try:
res = await User.objects.get(email=content)
res = await User.objects.get(email=content, verified=True)
except ormar.exceptions.NoMatch:
return None
await insert_into_redis(res, content)
return res
elif criteria == "username":
try:
res = await User.objects.get(username=content)
res = await User.objects.get(username=content, verified=True)
except ormar.exceptions.NoMatch:
return None
await insert_into_redis(res, content)
@@ -27,7 +27,7 @@ async def cache_account(criteria: str, content: str) -> Union[User, None]:
elif criteria == "id":
try:
res = await User.objects.get(id=uuid.UUID(content))
res = await User.objects.get(id=uuid.UUID(content), verified=True)
except ormar.exceptions.NoMatch:
return None
await insert_into_redis(res, content)