diff --git a/authorization.sh b/authorization.sh index 1c1a91d..f74dd12 100755 --- a/authorization.sh +++ b/authorization.sh @@ -1,7 +1,7 @@ BASEPATH=$(dirname $(realpath $0)) . $BASEPATH/.env AUTH_TOKEN=$(echo $(curl --request POST --header 'Content-Type: application/x-www-form-urlencoded' --header 'Accept: application/json' --data-urlencode client_id=sipgate-app-web --data-urlencode grant_type=password --data-urlencode username=$SIPUSER --data-urlencode password=$SIPPWD https://api.sipgate.com/login/sipgate-apps/protocol/openid-connect/token -s | jq '.access_token') | sed 's/\"//g') -if [ -z "$AUTH_TOKEN" ]; +if [ -z "$AUTH_TOKEN" ] || [ $AUTH_TOKEN = "null" ]; then echo "Login failed" else diff --git a/faxreport.sh b/faxreport.sh index 0eff67d..ca54d12 100755 --- a/faxreport.sh +++ b/faxreport.sh @@ -51,10 +51,13 @@ OUTFILE="$DATE-$ID-report.pdf" if [ -z $FILE ] then echo "Fax seems not to be sent successfully (yet). No report available" - read -p "Delete id from history anyways? (y/n) " DIN - if [[ $DF = true && $DIN =~ [yYjJ] ]] + if [ $DF = true ] then - echo "$(grep -v "^$ID$" $BASEPATH/.fax_history)" > $BASEPATH/.fax_history + read -p "Delete id from history anyways? (y/n) " DIN + if [ $DIN =~ [yYjJ] ] + then + echo "$(grep -v "^$ID$" $BASEPATH/.fax_history)" > $BASEPATH/.fax_history + fi fi exit 1 fi