Тест кода
This commit is contained in:
parent
ab989c6020
commit
fe3d283e3c
2 changed files with 70 additions and 61 deletions
|
@ -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:
|
||||
|
|
|
@ -16,80 +16,87 @@ def create_registration_confirmation_template(
|
|||
|
||||
email.set_content(
|
||||
f"""
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<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%;
|
||||
</head>
|
||||
<body style="margin: 0;
|
||||
padding: 0;">
|
||||
<table cellpadding="10" cellspacing="0" width="100%" style="background-color: #101010;">
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<div style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content:space-around;
|
||||
align-items: center;
|
||||
text-align:center;
|
||||
|
||||
display: flex;
|
||||
flex-direction:column;
|
||||
align-items: center;
|
||||
max-width:500px;
|
||||
min-width:350px;
|
||||
aspect-ratio: 1 / 1.34;
|
||||
|
||||
background-color:#101010;
|
||||
|
||||
font-family: 'Comfortaa';
|
||||
font-weight: 200;
|
||||
font-style: normal;
|
||||
font-stretch: normal;
|
||||
font-optical-sizing: auto;
|
||||
">
|
||||
|
||||
<div style="
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content:space-around;
|
||||
align-items: center;
|
||||
text-align:center;
|
||||
|
||||
height:500px;
|
||||
aspect-ratio: 1 / 1.44;
|
||||
|
||||
border: 1px solid transparent;
|
||||
background:
|
||||
linear-gradient(#101010, #101010) padding-box,
|
||||
linear-gradient(to bottom, #3C53FF, #7734AA) border-box;
|
||||
border-radius: 15px;
|
||||
">
|
||||
|
||||
<h1 style="color:white;">Код подтверждения, {username}</h1>
|
||||
<div style="
|
||||
border: 1px solid transparent;
|
||||
background:
|
||||
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;
|
||||
">
|
||||
|
||||
<h1 style="color:white;">или</h1>
|
||||
<h1 style="color:white; font-family: comfortaa;">Код подтверждения для сладкого {username}</h1>
|
||||
|
||||
<a href="{confirmation_link}" style="
|
||||
border: 1px solid transparent;
|
||||
background:
|
||||
linear-gradient(#101010, #101010) padding-box,
|
||||
linear-gradient(to bottom, #3C53FF, #7734AA) border-box;
|
||||
border-radius: 15px;
|
||||
text-decoration: none;
|
||||
">
|
||||
<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: 12px;
|
||||
|
||||
<h2 style="color: white; padding:0 5px 0 5px;">перейдите по ссылке</h2>
|
||||
</a>
|
||||
</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: 12px;
|
||||
text-decoration: none;
|
||||
|
||||
font-family: comfortaa;
|
||||
font-size:1.5em;
|
||||
">перейдите по ссылке
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
""",
|
||||
subtype="html",
|
||||
)
|
||||
|
@ -165,7 +172,7 @@ def create_data_change_confirmation_email(username: str, email_to: EmailStr, _:
|
|||
</body>
|
||||
</body>
|
||||
</html>
|
||||
""",
|
||||
""",
|
||||
subtype="html",
|
||||
)
|
||||
return email
|
||||
|
@ -230,7 +237,7 @@ def create_data_change_email(username: str, email_to: EmailStr):
|
|||
</body>
|
||||
</body>
|
||||
</html>
|
||||
""",
|
||||
""",
|
||||
subtype="html",
|
||||
)
|
||||
return email
|
||||
|
|
Loading…
Add table
Reference in a new issue