Added access tokens for duplicates

This commit is contained in:
Profitroll
2023-02-18 00:19:46 +01:00
parent fe2ef49c74
commit f1a190f030
3 changed files with 73 additions and 5 deletions

View File

@@ -81,6 +81,13 @@ async def user_already_exists_exception_handler(request: Request, exc: UserAlrea
content={"detail": "User with this username already exists."},
)
@app.exception_handler(AccessTokenInvalidError)
async def access_token_invalid_exception_handler(request: Request, exc: AccessTokenInvalidError):
return UJSONResponse(
status_code=HTTP_401_UNAUTHORIZED,
content={"detail": "Invalid access token."},
)
@app.exception_handler(UserCredentialsInvalid)
async def user_credentials_invalid_exception_handler(request: Request, exc: UserCredentialsInvalid):
return UJSONResponse(