send mail wip
This commit is contained in:
parent
ab7f2e99bc
commit
d108c54d81
@ -1,4 +1,5 @@
|
||||
from fastapi_mail import ConnectionConfig
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
conf = ConnectionConfig(
|
||||
@ -9,5 +10,5 @@ conf = ConnectionConfig(
|
||||
MAIL_SERVER = "your mail server",
|
||||
MAIL_STARTTLS = True,
|
||||
MAIL_SSL_TLS = False,
|
||||
TEMPLATE_FOLDER = Path(__file__).parent / 'templates',
|
||||
TEMPLATE_FOLDER = Path(__file__).parents[1] / 'templates',
|
||||
)
|
||||
|
@ -1,5 +1,5 @@
|
||||
from fastapi import APIRouter, Depends, HTTPException, status
|
||||
from ..dependencies import users_token, permissions_checker, database
|
||||
from ..dependencies import users_token, permissions_checker, database, mail
|
||||
from ..models import users
|
||||
from typing import Annotated
|
||||
from bson import ObjectId
|
||||
@ -111,7 +111,8 @@ async def read_users_me(userSingle: users.UserCreate | None = None):
|
||||
raise HTTPException(
|
||||
status_code=status.HTTP_400_BAD_REQUEST,
|
||||
detail="Body request is empty"
|
||||
)
|
||||
)
|
||||
fm = FastMail(mail.conf)
|
||||
user_repository = users.UserRepository(database=database.database)
|
||||
current_user = users.User(username=userSingle.username, password=user_token.get_password_hash(userSingle.password))
|
||||
user_repository.save(current_user)
|
||||
|
Loading…
x
Reference in New Issue
Block a user