🐛 fix(store.py): add validation to check if user has a store API key set before creating a component
This commit is contained in:
parent
ce955a82fe
commit
cc6da7626e
1 changed files with 4 additions and 0 deletions
|
|
@ -26,6 +26,10 @@ def create_component(
|
||||||
user=Depends(auth_utils.get_current_active_user),
|
user=Depends(auth_utils.get_current_active_user),
|
||||||
settings_service=Depends(get_settings_service),
|
settings_service=Depends(get_settings_service),
|
||||||
):
|
):
|
||||||
|
if not user.store_api_key:
|
||||||
|
raise HTTPException(
|
||||||
|
status_code=400, detail="You must have a store API key set."
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
api_key = user.store_api_key
|
api_key = user.store_api_key
|
||||||
decrypted = auth_utils.decrypt_api_key(api_key, settings_service)
|
decrypted = auth_utils.decrypt_api_key(api_key, settings_service)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue