This commit is contained in:
Lee Salminen 2022-12-29 08:16:51 -06:00
parent 8265bbfeb5
commit 4ab5285156

View File

@ -1,6 +1,6 @@
import re
from http import HTTPStatus
from typing import Optional
import re
from bech32 import bech32_decode, convertbits
from fastapi import Query, Request, Response
@ -159,10 +159,11 @@ async def api_address_create(
status_code=HTTPStatus.NOT_FOUND, detail="You're sneaky, nice try."
)
regex = re.compile(r'^[a-z0-9_.]+$')
regex = re.compile(r"^[a-z0-9_.]+$")
if not re.fullmatch(regex, post_data.local_part.lower()):
raise HTTPException(
status_code=HTTPStatus.NOT_FOUND, detail="Only a-z, 0-9 and .-_ are allowed characters, case insensitive."
status_code=HTTPStatus.NOT_FOUND,
detail="Only a-z, 0-9 and .-_ are allowed characters, case insensitive.",
)
exists = await get_address_by_local_part(domain_id, post_data.local_part)