Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manage.sh new-provider does not check status code of response #97

Open
rgmz opened this issue Mar 21, 2023 · 1 comment
Open

manage.sh new-provider does not check status code of response #97

rgmz opened this issue Mar 21, 2023 · 1 comment

Comments

@rgmz
Copy link

rgmz commented Mar 21, 2023

Description

The ./manage.sh new-provider script does not check whether the request was successful, meaning it will print "Done. Please check your e-mail." even if the request failed. I am not a shell aficionado, otherwise I would open a PR to fix this.

lithium/manage.sh

Lines 99 to 110 in 5fb635b

echo "Registering $provider_name ..."
resp=$(curl -s -X POST "$zapi/provider/register" \
-H 'Content-Type: application/json' \
-d '{"name": "'"$provider_name"'",
"email": "'"$provider_email"'",
"url": "'"$provider_url"'",
"description": "'"$provider_descr"'"
}')
echo "$resp"
echo "$resp" | jq -r '.password' > ${provider_ident}/.password
echo "$provider_email" > ${provider_ident}/.email
echo "Done. Please check your e-mail."

Example

$ ./manage.sh new-provider
Local identifier [default: test]: 
Provider name: test
Provider email: test@example.com
Provider homepage: 
Provider description: 
Creating directory test...
Registering test...       
{"code":400,"label":"bad-request","message":"Error in $.url: Failed reading: MalformedScheme NonAlphaLeading"}
Done. Please check your e-mail.
@rgmz
Copy link
Author

rgmz commented Mar 21, 2023

This is applicable to auth-provider as well.

lithium/manage.sh

Lines 73 to 79 in 5fb635b

curl -s -XPOST "$zapi/provider/login" \
-H 'Content-Type: application/json' \
-d '{"email":"'"$auth_email"'"
,"password":"'"$auth_password"'"}' \
-c ./.cookie
echo "$auth_ident" > .current
echo "Authenticated as $auth_email"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant