chore: code formatting

This commit is contained in:
Timothy J. Baek 2024-03-29 13:06:18 -07:00
parent 047c9fe82c
commit 12287f8680

View file

@ -103,15 +103,20 @@ async def update_password(
async def signin(request: Request, form_data: SigninForm):
if WEBUI_AUTH_TRUSTED_EMAIL_HEADER:
if WEBUI_AUTH_TRUSTED_EMAIL_HEADER not in request.headers:
raise HTTPException(400,
detail=ERROR_MESSAGES.INVALID_TRUSTED_HEADER)
raise HTTPException(400, detail=ERROR_MESSAGES.INVALID_TRUSTED_HEADER)
trusted_email = request.headers[WEBUI_AUTH_TRUSTED_EMAIL_HEADER].lower()
if not Users.get_user_by_email(trusted_email.lower()):
await signup(request, SignupForm(email=trusted_email, password=str(uuid.uuid4()), name=trusted_email))
await signup(
request,
SignupForm(
email=trusted_email, password=str(uuid.uuid4()), name=trusted_email
),
)
user = Auths.authenticate_user_by_trusted_header(trusted_email)
else:
user = Auths.authenticate_user(form_data.email.lower(),
form_data.password)
user = Auths.authenticate_user(form_data.email.lower(), form_data.password)
if user:
token = create_token(
data={"id": user.id},