remove Base64Str type from altcha
This was decoding the string, which the altcha validator expects to do itself. Now it works.
This commit is contained in:
@@ -8,7 +8,7 @@ from altcha import Payload as AltchaPayload, verify_solution
|
||||
|
||||
from urllib.parse import urlparse, ParseResult
|
||||
|
||||
from slopserver.server import settings
|
||||
from slopserver.settings import settings
|
||||
|
||||
NAMING_CONVENTION = {
|
||||
"ix": "ix_%(column_0_label)s",
|
||||
@@ -85,4 +85,4 @@ class SlopReport(BaseModel):
|
||||
class SignupForm(BaseModel):
|
||||
email: EmailStr
|
||||
password: SecretStr
|
||||
altcha: Annotated[Base64Str, AfterValidator(altcha_validator)]
|
||||
altcha: Annotated[str, AfterValidator(altcha_validator)]
|
||||
@@ -17,7 +17,7 @@ from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
|
||||
from pydantic import AfterValidator, Base64Str
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
from sqlalchemy import create_engine
|
||||
|
||||
@@ -29,7 +29,7 @@ import jwt
|
||||
|
||||
from uuid import uuid4
|
||||
|
||||
|
||||
from slopserver.settings import settings
|
||||
from slopserver.models import Domain, Path, User
|
||||
from slopserver.models import SlopReport, SignupForm, altcha_validator
|
||||
from slopserver.db import select_slop, insert_slop, get_user, create_user
|
||||
@@ -38,13 +38,6 @@ app = FastAPI()
|
||||
|
||||
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
||||
|
||||
class ServerSettings(BaseSettings):
|
||||
db_url: str = "sqlite+pysqlite:///test_db.sqlite"
|
||||
token_secret: str = "5bcc778a96b090c3ac1d587bb694a060eaf7bdb5832365f91d5078faf1fff210"
|
||||
altcha_secret: str = "0460de065912d0292df1e7422a5ed2dc362ed56d6bab64fe50b89957463061f3"
|
||||
|
||||
settings = ServerSettings()
|
||||
|
||||
|
||||
DB_ENGINE = create_engine(settings.db_url)
|
||||
TOKEN_SECRET = settings.token_secret
|
||||
|
||||
9
slopserver/settings.py
Normal file
9
slopserver/settings.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class ServerSettings(BaseSettings):
|
||||
db_url: str = "sqlite+pysqlite:///test_db.sqlite"
|
||||
token_secret: str = "5bcc778a96b090c3ac1d587bb694a060eaf7bdb5832365f91d5078faf1fff210"
|
||||
altcha_secret: str = "0460de065912d0292df1e7422a5ed2dc362ed56d6bab64fe50b89957463061f3"
|
||||
|
||||
settings = ServerSettings()
|
||||
Reference in New Issue
Block a user