Тест кода

This commit is contained in:
urec56 2024-08-27 19:11:18 +04:00
parent ab989c6020
commit fe3d283e3c
2 changed files with 70 additions and 61 deletions

View file

@ -1,3 +1,4 @@
import logging
from datetime import timedelta
from pydantic import ValidationError
@ -75,6 +76,7 @@ class UserService:
verification_code = await redis.get_value(key=f"user_verification_code: {user.id}")
except AttributeError:
raise WrongCodeException
logging.warning(verification_code)
if verification_code != confirmation_code:
raise WrongCodeException
async with uow:

View file

@ -16,7 +16,6 @@ def create_registration_confirmation_template(
email.set_content(
f"""
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
@ -26,24 +25,17 @@ def create_registration_confirmation_template(
<link href="https://fonts.googleapis.com/css2?family=Comfortaa:wght@200&display=swap" rel="stylesheet">
<title>Submiting</title>
</head>
<body>
<body style="
width:99%;
height:99%;
display: flex;
flex-direction:column;
align-items: center;
background-color:#101010;
font-family: 'Comfortaa';
font-weight: 200;
font-style: normal;
font-stretch: normal;
font-optical-sizing: auto;
">
<body style="margin: 0;
padding: 0;">
<table cellpadding="10" cellspacing="0" width="100%" style="background-color: #101010;">
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td align="center">
<div style="
display: flex;
flex-direction: column;
@ -51,43 +43,58 @@ def create_registration_confirmation_template(
align-items: center;
text-align:center;
height:500px;
aspect-ratio: 1 / 1.44;
max-width:500px;
min-width:350px;
aspect-ratio: 1 / 1.34;
border: 1px solid transparent;
background:
linear-gradient(#101010, #101010) padding-box,
linear-gradient(to bottom, #3C53FF, #7734AA) border-box;
border-radius: 15px;
border-radius: 12px;
font-family: comfortaa;
">
<h1 style="color:white;">Код подтверждения, {username}</h1>
<div style="
<h1 style="color:white; font-family: comfortaa;">Код подтверждения для сладкого {username}</h1>
<h2 style="
padding: 10px;
color: white;
border: 1px solid transparent;
background:
linear-gradient(#101010, #101010) padding-box,
linear-gradient(to bottom, #3C53FF, #7734AA) border-box;
border-radius: 15px;
">
border-radius: 12px;
<h2 style="color:white; padding:0 5px 0 5px;">{confirmation_code}</h2>
</div>
font-family: comfortaa;
">{confirmation_code}</h2>
<h1 style="color:white;">или</h1>
<a href="{confirmation_link}" style="
padding: 10px;
color: white;
border: 1px solid transparent;
background:
linear-gradient(#101010, #101010) padding-box,
linear-gradient(to bottom, #3C53FF, #7734AA) border-box;
border-radius: 15px;
border-radius: 12px;
text-decoration: none;
">
<h2 style="color: white; padding:0 5px 0 5px;">перейдите по ссылке</h2>
font-family: comfortaa;
font-size:1.5em;
">перейдите по ссылке
</a>
</div>
</body>
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
</body>
</html>
""",